Actionscript 3 :: Using Events Vs. Directly Calling Parent Application Function From A Child In Flex / Flash Builder

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


Similar Posts:


ActionScript 3.0 :: Parent Calling Child Function?

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

ActionScript 3.0 :: Calling Function In Child Swf From Parent

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

ActionScript 3.0 :: Child Calling Parent Function?

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

ActionScript 3.0 :: Calling A Parent Function When Child .swf Closes

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

ActionScript 3.0 :: Nested Child Calling Root Parent Function ?

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

Flex :: Can A .swf Loaded With SWFLoader Propagate Events To The Parent Application

Aug 2, 2010

I am building a compartmentalized Flex application which uses <SWFLoader > to load additional Flex applications inside it. I am currently planning on using the LocalConnection class to have these two applications talk to each other, but I'm wondering if there's any kind of event driven way to have actions in the internal application propagate to the parent application, and/or any way for the parent application to trigger events in the internal application?

View 1 Replies

ActionScript 3.0 :: Flash Calling Parent From Child

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

Flex :: Call Child Function From Within Parent?

Jun 1, 2011

Is it possible to call a child function from within the parent? I know to go child > parent, you can do parentApplication.functionName(parameters);, but what about going the other way... that is parent > child?

View 2 Replies

Flex :: Parent Not Executing Child's Function

Jun 7, 2011

I have a main.mxml, child.mxml and headermenu.mxml. I click a button on the headermenu that dispatches an event up to the main.mxml which then executes a method in child.mxml. I know this works because I put an AlertDialog in the function I'm calling inside of the child.mxml. The child.mxml contains a drawingArea object that has an erase(). When I call this directly from child.xml it executes, however if I put drawingArea.erase() inside of the function being called by child's parent (main.mxml) nothing happens.[code]...

View 1 Replies

Calling JavaScript Function From Flex 4 Web Application?

Oct 19, 2010

I need to call javascript function from Flash 4 based web application. When I run it in Debug mode it runs perfectly but when I make release build or run same application on other machine it does not call JavaScript function.

[Code]...

View 2 Replies

Actionscript :: Calling Function In A Mxml Component From A Main Flex Application

Dec 20, 2010

In my main application I have a viewstack with 3 child views. In the viewstack change handler, I programmatically change the selectedchild property.

I understand that the initialize method for the view is not called every time I change the selectedChild Property. So I tried to invoke the init method programmatically too..

view1.mxml
<fx:Script>
<![CDATA[

[Code].....

View 2 Replies

Actionscript 3.0 :: Child And Parent Events

May 14, 2009

I'm creating a tree menu, and when you click a parent, it populates a MC inside that parent - children that you can also click on. The parent is a chapter and the child is a screen.clicking on the parent closes the children. clicking on the children should load a screen. But instead, when I click on a child, it acts as if I'm clicking on the parent.[code]

View 9 Replies

Actionscript 3.0 :: Parent Listening For Child Events?

Aug 25, 2009

I am making a game that uses MVC pattern. The game.swf is loaded into main.swf. I want to dispatch a gameOver event from the Model Class of the game.swf and have the main.swf(parent) listen for it but I can't get it to work.

I have game.swf dispatching events fine amongst itself just fine but I can't get the parent to hear anything.

I tried this in the main.swf

Code: Select allvar loader:Loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, completeHandler);
function gameOver(e:Event):void
{

[Code].....

View 1 Replies

Actionscript 3.0 :: Calling Functions Between Parent & Child SWF [FLA Included]?

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

ActionScript 3.0 :: MouseEnabled On Parent But Child Still Gets The Mouse Events?

Dec 29, 2011

I have several sprites nested in containers. Let's say, that there are six containers (each represented by a Sprite) nested. I use the mouseChildren = false property on the container at depth 3, so the containers that lie deeper cannot receive mouse events. But still, I want that the container at depth 6 can receive mouse events

View 1 Replies

ActionScript 3.0 :: Child Calling Parent - How To Avoid Overlapping On Screen

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

ActionScript 3.0 :: Flash Executing Parent Function From Within Child

Jun 11, 2010

I have this movieClip "Container" and within it on two different frames I have two movieClip/buttons, "pause_btn" and "play_btn", respectively. I would like to call a function on the main timeline on frame two of "Container" where "play_btn" is located.
I think I'm getting close but really have no idea. I know about the visible property and have been considering that, but isn't there a way to call a parent function from within a child movie clip? The code looks like this.

[Code]...

View 3 Replies

ActionScript 3.0 :: Calling Function From Child To Child?

Dec 9, 2010

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?

View 2 Replies

Flash :: Make User Go To Application Page Instead Directly Go To Application?

Aug 26, 2011

Currently i'm developing a facebooks apps with falsh application. i've have completed the development with all API required to run a facebook apps. Everything went well and it's live now. My question :

1. How can make user to go directly to the application page everytime they click the link posted by user who already use the application instead going to the canvas page applications. i'm been trying to look for the article that support saying that user will go directly to application directly to canvas application page instead of going to the application page.

View 1 Replies

Flash :: Flex - Builder 4.5 Won't Run Application

Jan 30, 2012

I was running my application from Flash Builder 4.5.1 without any issues. (It is a Flex application that connects to .Net Web Services). However, something has changed recently in my configuration or project, because when I try to run the app with the play or debug button, I just get a grey screen. I can't even stop on any breakpoints. Eventually (maybe 30 seconds), a message pops up like so: 'The Flash Builer failed to connect to the running application. Please make sure that you are running the debug version of Flash Player...'

[Code]...

View 2 Replies

ActionScript 3.0 :: Calling A Function On Parent Swf

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

ActionScript 3.0 :: Calling A Function Of A Parent?

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

ActionScript 2.0 :: Calling Function In Parent Swf

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

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

ActionScript 3.0 :: Calling A Parent Function?

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

Flex :: Flash Builder - More Than One TitleWindow In An Application?

Mar 30, 2011

I'm a GIS Analyst that was moved to an Analyst Programmer position. This has been a hard transition for me as I don't have much of a programming background, but I was thrown into it. 'm working on a Flex app inside a jsp page. Essentially it is a grid 3x2 that has images and text. What I am trying to do is have more than one titleWindow reference in this page, so that when an image is clicked a titleWindow is opened. (If anyone has a better idea, especially if it has to do with a hover I am very open to that!) Currently I have it working for one image. However, when I try to add a second function it errors on me. "Error 1021: Duplicate function definition" Below is the entire code for the main page that calls up the titleWindow. The code below is what gives the Error 1021.

<?xml version="1.0" encoding="utf-8"?>
<![CDATA[
import flash.geom.Point;

[code]....

View 1 Replies

Actionscript 3.0 :: Calling A Function In A Loaded SWF From A Parent SWF?

Jan 21, 2009

syntax for calling a function (and sending arguments) located in an external SWF from a parent SWF?

View 2 Replies

ActionScript 3.0 :: Calling Function In Parent From External SWF?

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

ActionScript 3.0 :: Parent.removeChild(child) Doesn't Update Parent Width / Height When Child Was Rotated

Jul 29, 2011

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.

View 10 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved