ActionScript 3.0 :: Flash Resizing And Centering Child Holder On Stage, After Loading External Photo?
Apr 5, 2011
im loading photos of different aspect ratios with a loader onto a child holder frame_mc. I wanted to know what AS3 commands do i need to work on to get the frame_mc to resize to the new childs dimensions and centerize itself on the main stage? (as in event listeners, functions, vars etc)
Then I load an external swf into a mc, and it goes full screen as expected. BUT the main swf that loaded that external one, at the time of load, suddenly gets scaled back down to its normal size: 960x600, on the top left corner of the Player Window (or the full screen), so somehow at 0,0. Whn I unload the external swf, I can put the code stage.scaleMode = StageScaleMode.SHOW_ALL; to get it back to where it was. But unfortunately I have some buttons from the Main swf that are supposed to be on top of the loaded one, and should stay where they are. But now they all move because of this scaling down.
the mc that is being used as a container for the loaded external swf is an empty mc located at 0,0. The external swf has the same size as the main one: 960x600
I searched and tried things but could not get it to stay in show-all mode when loading this external swf...
I am trying to load a swf into a holder movie clip from the child movieclip.It's parent has a holder that i want to load a swf into.I am navigating from within a child clip.It would be nice to have the swfs load from an external xml file but it isn't mandatory.
how to center an image that is smaller than its attachMovie parent. Basically I have a blank slide (a 94 x 94 square) that I load dynamically image thumbnails into. Some of them may be 92 wide and others 92 tall but never anymore than that. The problem I have is that all images loaded are aligned to the top of the mc they replace and if a thumbnail is 92 wide by 20 tall than theres alot of space underneath it - i need to center (both vertically and horizontally) the loaded data and I have come up stumped.
note I have to change some file names and urls for company privacy.I am working on an online banner ad which tight size requirements. In order to stay under the file size, I want to load an external swf housed on our server into an empty movie clip on a button press. I have this working with the following code on a button:
on (release) { loader_mc.loadMovie("location where swf file is housed"); }
I then want to unload this movie if a different button is pressed. However I am receiving the following error.
*** Security Sandbox Violation *** Connection to file: XXXXXXXX halted - not permitted from "location where swf file is housed" -- Remote SWFs may not access local files.
How can I unload this external swf file from my move? Again the external swf file is housed on our sever and the main swf file will be housed with the place we are advertising.
last step in my interactive CD project.The photos in my xml photogallery swf work fine. However, when I load the xml photogallery swf into my index swf, the pictures stop loading after picture 1.AS 3.0 code for xml photo gallery swf (adapted from the tutorial)
Code: import flash.events.MouseEvent; function loadXML(loaded) {
I am using the kirupa xml foto gallery and I am loading different sized images... if they would load nicely centered the problem is solved... (not to stage width/height..!!) The movieclip "picture" has to load the images centered from its own registration point so that it can be placed anywhere on the stage.... now its loads the images from aka left top...
This code works. It puts my external image on the stage: Code: var pngurl:URLRequest=new URLRequest("image.png"); var pngloader:Loader=new Loader(); pngloader.load(pngurl); this.addChild(pngloader);
This code works to, but not completely. It stores the same image inside of a movie clip that I've named "panel". However, the image is bigger than "panel": Code: var pngurl:URLRequest=new URLRequest("image.png"); var pngloader:Loader=new Loader(); pngloader.load(pngurl); panel.addChild(pngloader); //panel is the name of my movieclip
I almost fixed my problem by changing my code. My image is smaller than "panel" now, but its width and height should be the same as "panel": [Code] ..... (Original image size= 350width and 250height) (Panel size=100width and 100height)
I'm loading external swf into my main project for sub sections to keep size down.My main project is 1280 x 700px in size.In those sub-section I have some content with a scroller.When I load the swf and check the size its ok. But as soon as the scrollbars is initialized scroll bar is initialized the size of the external includes the text that goes off-stage for the sroller.I can resize it propotionaly when after its loader because i have the correct values. But if the user resizes his browser I get the wrong values and my resize code doesnt work because it's height is now incorrect.So is there a way to not include the off-stage elements to count as the height ?
I was looking at this tutorial, this is exactly what I am trying to do with my website, but this is AS3, is there a way to change the code so it will function exactly the same but with AS2 code instead.
I have already contstructed my site with AS2, which then wont allow this code to work, Is there even a way I can have an AS3 index file that loads the movies with the AS2 and applies the same resizing to the movies that have been loaded.
When I load an external SWF into a container (be it a sprite or mc), and then retrieve the contentLoaderInfo for 'height' and 'width', and attempt to resize the either the SWF (loader content) OR the Sprite/MovieClip to a smaller size, using the loaderInfo to maintain aspect ratio, it resizes all the elements that are offstage as well.
I've been playing around with a code that keeps a specific object on the center of the movie when the window is re-sized. It works well but here is the issue: I don't want the object to be centered at the very center of the window but on a specific x,y coordinate. How can I modify this code to assign an x,y coordinate so that the object will be "centered" in reference to that coordinate?
Next, is the code. "centerlogo" is the object to be centered and "backgroundImage" is as the name implies the background. I know that what i ask has to do with the part under the "//center content" comment
function init() { stage.align=StageAlign.TOP_LEFT; stage.scaleMode=StageScaleMode.NO_SCALE;
I have a request to bulid the Flash website looking somewhat similar to LabelloI need a fullscreen flash that position elements dinamically, based on the stage dimensions. I found this tutorial on Kirupa:I need to do the same, but in AS 2.0, since it is the requirement.Is there any tutorial or finished script for this or I just need to write the code from scratch, as I'm not so good in AS3?
I have a code for a page I am using and I would like to add a background and have it resize with the screen like the rest of the page. I have created a movie button named "pic" with the image in it but I don't know how to write the code and place it in the existing AS3 code file.how to place the code like i was in 3rd grade, that would be great. Here is the existing code.
I am using CS4 and ActionScript 2.0.I am trying to create a photo gallery.I have created 4 different movie clip buttons that reside on the content layer.Each button consists of one image.When the movie clip button is pressed, I want the full size image to appear on the stage next to the buttons.You can see the buttons in the image below.I am trying to create an empty movie clip holder that would reside on the main timeline while the buttons reside on the content layer.I need to get the images to load into the empty movie clip and then unload when the next button is selected?I can't seem to get the buttons to "talk" to the empty movie clip holder.I did manage to create code for an empty movie clip holder within each button, but then I end up with all four images on top of each other.
If my holder's alpha equals 0 can its child's alpha be effectively > 0 ? In my case I have holders (custom clases) with many children, some of which are holders them selves (with their own children and holders and so on).
I would like to: -pick out a single holder from the 'tree' -have all of the 1st level children of that are NOT holders themselves have an alpha of 1.
I want to load an external swf to the background and then have it resized proportionally according to the browser window so it can fill up the whole screen.
I want to load an external swf to the background and then have it resized proportionally according to the browser window so it can fill up the whole screen. Could anyone point me to any online tutorials or show me how to do it?
I have a code for a page I am using and I would like to add a background and have it resize with the screen like the rest of the page. I have created a movie button named "pic" with the image in it but I don't know how to write the code and place it in the existing AS3 code file. I am brand new to this so if someone could tell me how to place the code like i was in 3rd grade, that would be great. Here is the existing code.
I've just run through this tutorial and I've got my site centering in my browser as planned.However when I resize my browser window the text (I'm using a pixel font) is going fuzzy.Is there some way I can lock 'centerRectangle' to a rounded X and Y coordinate so that this doesn't happen?
I have a main flash container move that loads in multiple swf files. I created a movieclip container in the main flash container that resizes and positions according to the stage height and width as follows:
This works fine if no graphics are off the stage in the loaded swfs. Otherwise if I have a scrolling menu and the buttons out width the containing mc it takes into account the masked content width and centers the movieclip accordingly throwing alignment off.
Is there a way to ignore masked content when getting stage width and height?
I am loading a photo gallery as an external swf.So I have a preloader for the ext swf that loads.Then there is a 3 - 4 second delay before the % preloader for the photo gallery starts to load.I'm loading it via xml - is it taking 3 - 4 seconds to read the xml page before the image starts to load?
I am having a problem centering a photo that is resizeable in fullscreen. Meaning it adapts to your monitor size. How would I keep the aspect ratio? I would not mind having black bars at the top and bottom as well.
Example is like this here:
[URL]
It may look fine if you have a normal monitor but if you have a widescreen the photo is distorted. The photo is saved as a movieclip.
i have both vertical and horizontal pictures... The horizontal pictures work great! But what code and where would I add it if I wanted to tell Flash to center the vertical photos in the large gallery.
The photos in my xml photogallery swf work fine. However, when I load the xml photogallery swf into my index swf, the pictures stop loading after picture 1
Code: import flash.events.MouseEvent; function loadXML(loaded) {
I'm looking for the best way to get a flex 4 image object to resize and horizontally center whenever its parent container (a custom component based on group) resizes. I cannot set horizontalCenter="0" to accomplish the image centering because I use a move transition to "slide" the image in and out of view.
I'm externally setting the image source in the component. Here is a simplified example of my component code that only addresses resizing the image.
I have a player that loads both images and videos. I am having a problem removing the previous child from the holder and am close to using tricks to fix it. I'd rather not. Here's the code that loads the image:
Code: var _mediaLoader:Loader = new Loader(); _mediaLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, imageLoaded); _mediaLoader.load(new URLRequest("blah.jpg"); function imageLoaded(e:Event):void{ videoConsole.imgHolder_mc.addChild(_mediaLoader); }
And my flv loader is a bunch of mumbo jumbo with this code at the end: Code: videoConsole.imgHolder_mc.addChild(flvPlayer); So, how can I remove the previous child, if there is one, when loading the next item on the playlist?
I've been going through the tutorials and forum trying to build a photo slideshow. I managed to get the slideshow working with buttons, but am really stuck with trying to center the images ... I'm using portrait and lanscape images, and want them both to be vertically and horizontally centered in a 504x504 moive.