I have container swf which includes navigation that loads child swfs. Each child swf is loaded then visibility is set to false. Once a child ( an image gallery actually) is loaded it is possible to jump from image to image. What Id would like to be able to do is call a "clean up" function that returns the child to its initial state when anothor nav link ( a different gallery) in the parent is clicked. But I do not know how the syntax is supposed to be written or if its even possible.
Ideally it would look something like this in the parent container swf:
ActionScript Code: function swapSectionIdentity(e:MouseEvent):void { setChildIndex(background_home, 0); getChildByName("identity_mc").visible = true;
[Code]...
the behavior I am attempting to avoid is when a child swf is loaded ( an image gallery) and then the child is invoked to display a particular image in it, afterwhich a main navigation link is clicked the current gallery is set to visible = false and a new gallery is set to visible = true. But when you return to the previous gallery the last image viewed is still showing. I want to be able to reutrn to galleries inital state as it is hidden. make sense?
I have setup a simple video interface. The video player lives in the parent swf. The video list chooser is loaded as a child swf. In this child swf, I have some video buttons nested within two movieclips in order to facilitate the scrolling feature. I am trying to get the movie buttons to load flvs into the component flv player in the parent swf. I have declared the functions in the parent and I am trying to call them in the child:Code in the Parent:
function vid1(event:MouseEvent): void{ pubPlayer.source = 'vid1.flv'; }
I am adding a child .swf from the parent with a simple button. If this button is then clicked multiple times, the child is added multiple times. So I added the ".visible = false" to the button when clicked so the button cannot be clicked while the child is open.
Now, there is "Close" button on the child .swf that uses "this.parent.parent.removeChild(this.parent);" and would now need to set the parent button back to ".visible = true".
I have tried MovieClip.parent.parent.resetButton(); and parent as MovieClip.resetButton(); and many variations of the code. I get no errors but the code doesn't work either.
I'm switching from as2 to as3 and everything was going swimmingly with my new site until i tried to use a _root call to a function on the main timeline by a loaded movieClip that is loaded nested into 2 other movieclips. the movieClip needs to tell the _root when it's done playing so the root knows to load the next one in line through a php call. Everything works except for the _root call. In as3 there's no such thing as root anymore so I figured no big deal, i'll just find out what the new thing is and holy crap wtf! I can't figure this out!! I've read from doing stuff like custom eventLisnters (which i am trying now) and casting the root as a movieClip and then I read this whole crazy tutorial on building an event structure and the proper MVC way of coding and blah blah blah ALL I WANT TO DO is tell the _root that the loaded MC has reached the end of its timeline. Basically if it were as2 i could just go _root.loadNext(); and it would work.how to make a loaded MC talk to the _root timeline and call a funciton from there?
If I need to call a specific function in the parent application from a child in a flex project, what's the best practice for this? Would it be to dispatch a custom event from the child and have a listener call that function? Or to directly call the function with FlexGlobals.topLevelApplication?
In my child constructor I use MovieClip(this.parent).blablabla() to retrieve info, yea I know I can pass it through the constructor, anyways I keep getting errors anytime I try to use MovieClip(this.parent) in the constructor, it gives a refrence error saying it's null.
Why doesn't that command work, is there a way around it (other than the constructor)? Is it because it's bad design? I'm calling a function that has alot of data, so I'm just passing this to the child and using the passed this data to call the parent atm, looking for a better MovieClip(this.parent) solution.
I have uploaded a ZIP file that includes the following files:
- main.fla
- child.fla
You can download to review my code (very small 16kb): http:[url]...........This simple example has a main SWF file that loads a child SWF using the dynamic loader method. Below is the code in the main.fla file:
Code: Select all/* MAIN SW */ import flash.net.URLRequest;[code]........
how do I get both parent and child SWFs to communicate with each other dynamically (to be able to call functions from each other, or pass variables)?
I am a Flash MX user, I have three files named PARENT.SWF, CHILD.SWF, and CHILD2.SWF. The PARENT.swf loads the CHILD.SWF, The CHILD.SWF loads, then the file CHILD.SWF loads another swf file: CHILD2.SWF
Now my question is: How can the file CHILD.SWF unloads itself to avoid overlapping with CHILD2.SWF on the screen. I try the command: removeChild(CHILD); from CHILD.SWF but it doesn't. work.
I have a main.swf. I have loaded two child-SWFs into it, child1.swf and child2.swf.... There´s a videoclip inside child1.swf, can I stop that video from child2.swf?
new to actionScript and trying to finish my final project, and i'm banging my head on a brick wall now, my question may be easy for some pros, basically i've loaded an external swf from a button at main.swf
[Code]...
this works fine. then i'm trying to disable the button function while the swf is loaded. I add another eventListener to the same button. function disableMenu( e:MouseEvent ):void { button1.mouseEnabled = false;}
that works too. ok now comes the problem. I have a close button on my child swf("content1.swf) to close itself and returen to main swf. but I want the button on main.swf to work again. so at the close button I add another eventListener hope to enable the menu. (note this is on the child swf!)
So, my problem, I have a Parent swf file that loads a bunch of smaller swf files. When I click on a button in one of these loaded swf files, I want to be able to call a function from the parent swf. Once called, the function manipulates things MC's within the parent swf.
new to actionScript and trying to finish my final project, and i'm banging my head on a brick wall now, my question may be easy for some pros,[code]this child swf is loaded from xml. and the close button is created by using AS file. The "button1" is just on the stage of the main swf. Maybe these make some difference so i can't just point it back using (root)?Any idea how do I resolve this? Or am I not supposedd to do it this way at all?
i have a swf that loads a swf that loads one swf into that one. i need the final swf (child, child) to be able to call a function on the first swf (parent)
I got a Parent Sprite, let's name it SpriteP, which holds inside it two other Sprites. Sprite1 and Sprite2.[code]Sprite2 is a rectangle. When I rotate it, of course, the height of its parent, SpriteP, GROWS. But I would expect that height to go back to what it should be when I'm removing Sprite2!And it does! If I remove Sprite2 while NOT being rotated, the height of the parent drops back to normal, 200.
i am slightly confused about the parent and child relationship. lets assume we have several different instances, what would be difference of adding them all as children of the stage and creating a parent-child hierarchy between them(other than the access path).
I got a Parent Sprite, let's name it SpriteP, which holds inside it two other Sprites. Sprite1 and Sprite2.
When Sprite2 is NOT rotated:
Code: trace(SpriteP.width + ' ' + SpriteP.height); //100 250. SpriteP.removeChild(Sprite2) trace(SpriteP.width + ' ' + SpriteP.height); //100 200. -> works, 200 is good. When Sprite2 is rotated at 90:
[Code].....
And it does! If I remove Sprite2 while NOT being rotated, the height of the parent drops back to normal, 200. But if I rotate Sprite2, the Parent won't update its bounds.
I have setup a video interface with a stock video player in the parent mc. In the same swf next to the player, I have a mc which is a video thumbnail chooser. The thumbnail buttons are located two levels down within this mc (nested within two mc) in order to facilitate the scrolling independent of the player. In the parent, where the video player lives, I placed a function:
function vid1(event:MouseEvent): void{ pubPlayer.source = 'Steve480.flv'; }
In the child mc where the thumbnail buttons are, I want to call the parent function like this:
I have setup a video interface with a stock video player in the parent mc. In the same swf next to the player, I have a mc which is a video thumbnail chooser. The thumbnail buttons are located two levels down within this mc (nested within two mc) in order to facilitate the scrolling independent of the player. In the parent, where the video player lives, I placed a function:
function vid1(event:MouseEvent): void{ pubPlayer.source = 'Steve480.flv'; }
In the child mc where the thumbnail buttons are, I want to call the parent function like this:
I have a .swf that has to load in a iFrame and needs to call a browser cookie javascript function that lives on the parent page that loads the iFrame.I'm using this:
I have a function (let's call it testFunction for right now ) on the actions layer in the main timeline There is a movie clip with 15 frames long in the library
i want to add a child of the movie clip on the stage, and call testFunction when it finishes playing
how can i do? i tried to call it in the child but nothing works
Or, is there any way to show child on the stage for only a period of time like 1 second and then remove it automaticly?
I'm working on a Flash MX application which involves a Parent movie and a Child movie.
I've loaded the Child movie into the Parent movie using LoadMovie. The instance name of the Child movie is Child1.
In the Child movie I have a user-defined function called getChildXML (we don't need to get into more details about the function).
The point here is that I want to call the getChildXML function from the Parent movie. I've tried something like Child1.getChildXML(); but with no luck.