ActionScript 3.0 :: Calling An Function On Parent Swf
May 12, 2009
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?
View 2 Replies
Similar Posts:
May 11, 2009
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!)
[Code]...
View 13 Replies
Aug 5, 2009
I have two movies... main.swf and content.swf, and I'm trying to call a function in my main.swf from my content.swf. Here is the code..
//function in main.swf
function appear (event:MouseEvent):void{
TweenLite.to(title1, 1, {autoAlpha:1, overwrite:false});
[Code].....
I got an error message as soon as i click on close_btn. It says appear() is not a property or method.
View 0 Replies
Apr 13, 2010
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.
View 2 Replies
Jan 29, 2010
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 have tried this:
if(MovieClip(parent.parent.parent)!=null){MovieCli p(parent.parent.parent).parentFunctionCall();}
[Code]....
View 2 Replies
May 23, 2011
May i know how to call child function(layer 2) in parent(layer 1)?
Layer 1 (Parent)
function changeAction():void{
changeColor();
}
This method will give me the error -> Call to a possibly undefined method changeColor.
Layer 2 (Child)
function changeColor():void{
trace("success");
}
View 4 Replies
Jul 27, 2009
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?
View 3 Replies
Jan 21, 2009
syntax for calling a function (and sending arguments) located in an external SWF from a parent SWF?
View 2 Replies
Mar 17, 2009
I want to call a function in my parent movie from my external swf wich is loaded through a loader. Can anyone give me a nudge
View 4 Replies
Mar 17, 2009
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';
}
[code].....
View 9 Replies
Apr 14, 2010
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.
View 2 Replies
Jul 9, 2009
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:
vid1_btn.addEventListener(MouseEvent.CLICK, vid1);
None of my clips are externally loaded, just nested in the same swf. How can I talk up or down the movieclip ladder?
View 0 Replies
Aug 7, 2009
Basically i am trying to call a function which is present in one.mxml from a pop-up in two.mxml with a parameter.
one.mxml :
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" >
<mx:Script>
<![CDATA[
[Code].....
How to i call parent's method when i don't know who the caller is?
View 0 Replies
Jul 9, 2009
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:
vid1_btn.addEventListener(MouseEvent.CLICK, vid1);
None of my clips are externally loaded, just nested in the same swf. How can I talk up or down the movieclip ladder?
View 2 Replies
Jul 18, 2010
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?
View 19 Replies
Jul 14, 2009
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:
xternalInterface.call("javascriptFunction");
View 1 Replies
Jun 21, 2011
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?
View 1 Replies
Mar 7, 2009
I am trying to call a parent and have it do a simple action. but i always get this error[code]...
View 1 Replies
Jan 22, 2009
[URL]
go to media >> aikido pictures
I am using this screen resolution: 1024 x 768
the whole website seems to work fine, but when I change my resolution to a higher resolution, everything works fine until I go to media >> aikido pictures, and then the whole parent swf is resized to a smaller size but the child swf is still filling the screen.
View 4 Replies
Feb 11, 2011
I have created a flash movie for displaying several videos. Also it has a first 'menu' flash movie which will call this video displaying swf after checking some Identifiers in 'menu'.
I am using code like this to call video displaying swf. Inside Menu.fla I wrote the below code to call CFStarVideoAS.swf.
var mLoader:Loader = new Loader();
var mRequest:URLRequest = new URLRequest("CFStarVideoAS.swf");
mLoader.contentLoaderInfo.addEventListener(Event.C OMPLETE, onCompleteHandler);
mLoader.load(mRequest);
stage.addChild(mLoader);
It loads the other movie but both movies are displaying together.
I have to unload Menu.swf, which is the first swf running.
My colleagues were using unloadMovieNum(0) with as1.
I tried mLoader.unload for a trial in as3 but not works. I read from some article that unload will work but don't know how and where to insert it.
View 0 Replies
Jul 21, 2011
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.
View 2 Replies
May 29, 2009
I have a main Flash file that loads up other SWF files using Loader objects. I want to be able to call methods of this main object from within the loaded SWF files. For instance, I want the loaded file to be able to add an event listener to the stage of the main file. I've found this example:
[URL]
Which appears to do what I want, but I can't figure out how to implement it in my setup.
My 'main file' that loads up other SWF's is called 'main.swf' and has a document class Main.
My loaded file is called start.swf, and has a document class "Start".
[Code]....
How can I reach the stage from a loaded SWF? Or at least, how can I call a function in my Main Class from the loaded start.swf file so I can move the functionality I need to the main.swf file?
View 5 Replies
Jul 29, 2010
I have an FlvPlayback skin, which works really well, except the custom button. Basically this button needs to be able to call a function in the parent movieclip (that loaded the FlvPlayback, which in turn loaded the skin).
I am not really a Flash developer, and have not found anything on Google relating to this. It seems like a simple issue, but I just do not have enough knowledge of flash.
How to call a function in the base swf which has a FlvPlayback movieclip, from a custom button in the skin file.
View 1 Replies
Mar 29, 2010
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)?
View 1 Replies
Dec 9, 2009
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.
View 3 Replies
Sep 23, 2011
I have an AS3 function that loads and audio file and then plays it. I have the pre-loader for the first audio file working - now I need to run the pre-load function before the 2nd audio file starts.
myMusic.addEventListener(ProgressEvent.PROGRESS, onLoadProgress2, false,0, true);
myMusic.addEventListener(Event.COMPLETE, playMusicNow, false, 0,true);
myMusic.load(soundFile, myContext); //This code works
[code].....
View 2 Replies
Feb 26, 2010
i'm trying to modify some code and can't figure out what the issue i'm having it. this is the(shortened) code:
public static function Lose():void {
trace("OVER!");
Clock.stop();[code]...
this is the error i get: 1180: Call to a possibly undefined method OverIt.i just want to call a function from inside of the public static funtion.both function are inside this class:
public class Game extends MovieClip {
}
View 4 Replies
May 12, 2004
Okay so I am reading through sens tutorial on OOP and updating my game that I am making. It is much easier to code this way (IMO) but still hitting snags.I am trying to get through this code:
[Code]...
View 3 Replies
Jul 29, 2010
Is it possible to access a function within a function in a parent swf from a loaded swf?
View 6 Replies
Dec 8, 2009
function test1():void
{
function test2():void {..}
[code].....
View 6 Replies