ActionScript 2.0 :: Loading Into Parent Container?
Sep 16, 2008
Late night dumb question time:I have an SWF named "gallery.swf" that loads into an empty clip called "holder_mc" in the parent movie. How do I call a function from gallery.swf that replaces gallery.swf with a file called "purchase.swf" in holder_mc? The function I'm using looks like this:
Code:
function ProceedToCart():Void {
_root.mcLoader.loadClip("purchase.swf",_root.holder_mc);
Embedded some characters using embed tag in flash CS3 (font.swf). 2 separate swf (a.swf,b.swf) loads the font.swf on runtime. These 2 swf are being called from a container (parent) swf. It looks find locally and not time consuming to load. But when I view it from a server, computer lags after a while.... (all file sizes are relatively small.around 160kb) What needs to be done in order to prevent computer from lagging? Is it better to load font.swf not in separate swf but directly in container(parent).swf?
I have 3 SWFs. X.SWF - Parent application. Contains an empty movie clip for loading external swfs using loadClip() method. B.SWF - Has some text and pics. Gets loaded into the empty movieclip on X.SWF. Also has a button saying 'Load A.SWF'. A.SWF - Similar to B.SWF with a button saying 'Load B.SWF'.
When I start the main application (X.SWF) and load B.SWF into it all is fine. But would like to click on the 'Load A.SWF' button on B.SWF and load A.SWF into X.SWF. And visa-versa. The problem is I'm not able to refer to the parent container (X) from these child (A and B) SWFs.
i'm a designer trying to step up my flash skills and have a scripting problem that's causing me trouble. essentially i have a child swf loaded into a container in a parent swf and want the child to be able to instruct the parent. to explain in full, the child contains an flv with bespoke video player components. it's container sits in one frame of the parent. when the flv finishes playing, i need the parent swf to move onto another frame. as it's a controllable flv, it isnt possible to predict the exact length of time the child will need to be present, so it literally needs to tell the parent it's finished playing at that very point.
I have a canvas onto which I draw shapes like rectangle etc. When I move the shape using my custom mouse down/mouse move handler, the shape can go outside the parent bounds.
I am checking if the child is outside the parent's bound to snap it back:
var bounds:Rectangle = this.getBounds(this.parent); var p:Point; if (bounds.x <0) {
[Code]...
The snapInside method gets called when I go outside the left or top boundary. But when the child is dragged outside the right or bottom boundary, I find Flex/Flash runtime automatically expands the parent's height and width. So say the parent size was initially 800x600, if child Y bounds exceed 800 by say 20 pixel, I find the this.parent.height automatically resized by flex to 820!!
How do I prevent the parent from resizing when child goes outside the original bounds of the parent ?
is it possible to retrieve all children of a certain type from a parent in actionscript 3? i only see getChildAt,getChildByName, is there a getchild of a certain type like get all childs of object type:Food?
I have spent nearly a day on this now, searching everywhere, but never found anything. This is my desperate attempt to get my problem solved. I have a container (ContentHolder extends Sprite), which holds another container (Content extends Sprite) which has a TLFTextfield in it.
Now when I resize the ContentHolder, its children get resized too. I have overridden set width and set height in the Content class, because I need the Content to resize differently than just scale. I want the TLFTextfield width to adjust to ContentHolder width, while maintaining font size. So ideally the TLFTextfield would set different line breaks, according to the width of ContentHolder.
I really have no idea how this can be achieved. One solution may be to create a new TLFTextfield instance with the updated height and width values, but that could look messy when drag-resizing the ContentHolder..
Is there an easy way to make a parent container (eg Group) resize when it's children resize?
Below is a little example app. When I put the 200x200 'food' in the 'stomach' the stomach & it's containing 100x100 'body' should resize to contain the food.
I have code like the following: <s:VGroup gap="10" id="group" height="100%"> <s:Label text="This is page 2" /> <s:Button content="Resize Canvas" click="resize(event);"/> <mx:Canvas id="photoCanvas" color="#567898" backgroundColor="#125567"> </mx:Canvas> </s:VGroup>
I don't understand why the following does not work: Pushing the Button resizes the photoCanvas's height (gets taller or smaller). Since the photoCanvas control is a child element of the VGroup shouldn't the container update itself to the new height? The Vgroup has ALWAYS the same height, no matter what the (total) height of the children is! I would like the VGroup to adjust itself and get a height value equal to the sum of its children heights. Is this not possible??
On the stage I have a movieclip (Container, originally 200px width) and inside it with a progressbar movieclip (originally 700px width), scaled with Free Transform Tool to fit the parent container. The width of the container changes run-time while resizing the scene.
In ActionScript I have a function which should set the progress bar width according to a calculated percentage value:
private function updateProgress(event:TimerEvent):void { var barWidth:int = _container.width; var progress:Number = _stream.time / _stream.duration * barWidth; _progressBar.width = progress; }
My problem is that the progressBar even at full time (100%) is only at 1/4 of the parent container. I assume that it comes from the symbols original size.
Can I correct this programatically, or I must redesign it with the "designer"?
I've successfully managed to load an external swf file into a movie, but I don't know how to resize it or position it... is this possible?
I'm using this code to load the swf into a movieclip called 'Holder':
Code: var Holder:Loader = new Loader(); var urlrHome:URLRequest = new URLRequest("myMovie.swf") Holder.load(urlrHome);
[Code]....
My 'Holder' is bigger than the swf importing, but ideally i would like to resize and position it in the center of the stage... (at the moment, the movie loads in small and sits at the top left corner of the stage, even though my container is in the middle...
there a more official name for a 'flash container' ? because very little results come up when i try and search for answers!can you load a container within a container, i'm thinking no but would like to clear that up also! for example i've followed this tutorial htm however when loaded up in a container nothing appears in the mouse over effect.. i've also tried loading jpegs into a swf via an xml which again works fine until i load it up within a container and nothing appears..
If a swf file is destined to be loaded into a container file and interacted with from there, is it considered better practice for the code for the interaction to reside in the loaded file or the container file? I am writing on the timeline, rather than creating classes. Also if a movie clip on the stage contains buttons with event listeners attached and I remove the movie clip as a child, do the event listeners disappear with it, or should i remove them separately?
On the Mac, everything works fine. I load a .swf into an ADM Flash Player Item in the Illustrator SDK and the .swf pulls some information from an options.xml file on local machine to create the UI.On Windows the .swf seemingly won't load info from other files on the computer. I can get the .swf to load inside the ADM Flash Player Item, but it seems like it can't access the options.xml file.When I run the .swf OUTSIDE of the illustrator container, everything works as it is supposed toI thought it might be a security/permissions issue, but wouldn't that come into play even when it's run outside of illustrator
I need to place a image in a container. But well it does not work It doesn't do anything actaully.Its been a while since a used ac3 but still does someone care to take a look?the picture that needs to be loaded and the xml file are all in the same folder.do i need to use a for loop? my teacher said it didnt need it.
// ------------- PICTURE LOADER ---------------- var PicXML:XML; var picXMLLoader:URLLoader = new URLLoader();
I'm trying to design a scrolling panel following one of the tutorials. I'm loading some photos using an XML into a container and I want this container to be reactive to mouseX. I can't get this movement all the smooth that I want. The images sometimes vibrate.[code]
i have a xml gallery with a mouse hover scroll bar which loads up photos. I want to have this movie clip load into a container in my menu movie clip but whenever i try nothing shows up. I can load other movie clips fine. I am guessing its something to do with the xml.
I have created a flash gallery where I am trying to fetch all thumbnails and large images from external folders. I am using the following code to load image blow-ups in a container:[code]While this works offline, when I upload the files, the thumbs are fetched from the image folder but not the large images. If there was an issue with the path, then thumbs should also not load.
I am doing a website with external swf using AS2 . The parent frame (container) is resizeable, the external swf is an animation. Some items draw outside external container. The external (swf with animation) will resize when parent frame (container) resized in scale.
The problem occurs when the parent frame resized, the flash programme define the width of external swf, such as the movieclips/jpeg outside the scene. (for example: both my Container and External swf are 1024x640. However, some of the graphics in the External Animation swf move outside this area. BUT the parent CONTAINER still RECOGNIZE and LOAD the content outside the defined stage.)
i found this izzue in FLEX, [URL]
Therefore, I would like to know if I could fix this in Flash CS3 (AS2) ?
I'm writing a preview site that will load SWFs/images from a URL into a preview pane. However, the primary problem I'm running into is actually loading these SWFs. It seems that the object/embed tags require width/height attributes. I will not know the exact size of these SWFs; in fact, I will know absolutely nothing about them.
What I'm asking is, what is the best way to load in these SWFs? Is there a library that exists to do this? Or do I need to do it myself?
I have a simple swf in an invisible <div>; when user mouseover's the <div> becomes visible.The swf has a ExternalInterface.addCallback( "..." , ... ) to create connection to js that needs to be called at load, such that by the time user mouseovers the flash-js connection is working.PROBLEM: on windows safari the flash does not go through its loading sequence until the user finally mouseovers
I am doing a website with external swf using AS2. The parent frame (container) is resizeable, the external swf is an animation. Some items draw outside external container. The external (swf with animation) will resize when parent frame (container) resized in scale.
The problem occurs when the parent frame resized, the flash programme define the width of external swf, such as the movieclips/jpeg outside the scene. (for example: both my Container and External swf are 1024x640. However, some of the graphics in the External Animation swf move outside this area. BUT the parent CONTAINER still RECOGNIZE and LOAD the content outside the defined stage.) i found this izzue in FLEX, [URL]
I have been trying endlessly to find a solution for a problem. All I want to do is to be able to load a loader container on to the stage and swap out each swf by hitting the corresponding btn. I found a code to do this and it works on static swfs but when I link xml photogallery swfs to it I get all kinds of output errors but the functions work in a browser. I know it is the code as I have tried 4 different kinds of xml photo galleries and all return similar output errors.
I know this is a bit of a pain in the @#$ but if someone could have a look at the zip file in the link below which contains a main.swf, an swf folder and one swf inside including all the xml. You will see what I mean. What I really need to acomplish is to have a set AS3 code for doing this, I'm sure a seasoned AS3 pro could look at the code in the file and see why I get the errors or I'll even settle for a code that works. I'm the kind of person that likes to know why something doesn't work and when it works I like to know how as well. This is one of the reasons I've been knocking myself out for days as you will see posts of mine about this.
I am creating a course that requires loading/unloading of several swfs in a container. My course structure is something like : Course->Module01->src->test.as ->Module02->src->test.as
When I load file from Module01 in my container it works fine, but files from Module02 is not working as they should. They seem to be reading the code from the as file in Module01. The course works fine when I give the as files different names, but I want to keep the names as they are now as I have created several modules and sub-modules on similar structure.
I'm working with several nested movie clips. My Main container (the GUI), and the content MC's. The Main Container loads, via a button, another SWF file into the MC "_root.content" (_root.content.loadMovie("filename.swf"))
Within that loaded swf file I've got a script to load information from an XML file, and add it to several dynamic text boxes. The XML loads fine, and the SWF file works fine, as long as it isn't in my container movie.. itmHeader = _root.attachMovie("movieName", "movieAlias")
I have tried root, parent, and this.. and none of them work while the SWF file is loaded into the container movie.. and the only one that works when I run the SWF file by it's self _root.attachMovie is the only command that shows the information as intended (at all).
I've got a movie clip that consists of a few other movie clips. This is to maintain a certain degree of order in the chaos. I use action script to load the container mc on the stage. Now I want to change some properties of on of the contained mc's, but they seem to be unreachable. So I did a little testing and I found out that when you just place an instance on the stage, those contained MC's are accesable, you can see in the debugger that the container MC contains other stuff. But if the MC is loaded with attachMovie(), the debugger does not show that the container has other mc's within it, and therefor I cannot change the properties of those mc's.