ActionScript 3.0 :: Make A Loaded SWF Call A Function That Is In The Parent SWF?
Jul 18, 2010
I'm trying to make a loaded SWF call a function that is in the parent SWF, but it is not working.In AS 2.0 I could just put something like _root.myFunction(); and it worked.But in AS 3.0 it does not work anymore.
View 3 Replies
Similar Posts:
Nov 10, 2009
I have a swf that should be able to load another swf in runtime. Then I would like the loaded swf to call a method of the parent, loader swf, like this:
Code:
parent.closeForm;
But when I compile it, it throws this error:
1119: Access of possibly undefined property closeForm through a reference with static type flash.displayisplayObjectContainer.
I've tried:
Code:
if (parent != stage){
parent.closeForm;
}
So flash won't run this code at compile time, but it always throws that error. Here is the code of the LOADER swf:
Code:
private function loadForm():void {
var loader:Loader = new Loader()
var mRequest:URLRequest = new URLRequest(formPath);
loader.load(mRequest);
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onFormCompleteHandler);
[Code] .....
How could I write an expression that should call a function of the LOADER swf without having this compile-time error?
View 14 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 0 Replies
Mar 7, 2009
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?
View 1 Replies
Feb 6, 2010
I want to call the parent function called "edit_groups()" from the itemRenderer. The code for my itemRenderer is:
<mx:VBox id="vbx_container" paddingBottom="4" paddingLeft="4" paddingRight="4" paddingTop="4" borderStyle="solid"
dropShadowEnabled="true" width="100%" height="100%" horizontalScrollPolicy="off" verticalScrollPolicy="off" >
<mx:Canvas width="100%" height="100%" horizontalScrollPolicy="off" verticalScrollPolicy="off" >
<mx:Image id="image" width="100" height="100" source="{data.thumb}" scaleContent="true" maintainAspectRatio="true"
complete="{image_smoothing_handler(event);}" trustContent="true" doubleClick="{Call The Parent Function"edit_groups()"}"/>
</mx:Canvas></mx:VBox>
And I call my itemRenderer from an application like:
list_groups_modify.itemRenderer=new ClassFactory(groups.list_groups_modify_item_renderer);
<mx:Label text="{data.label}" textAlign="center" maxWidth="60" toolTip="{data.label}"/>
View 3 Replies
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
Jan 23, 2009
how I reference vars/instances from a parent class by using a static function and I wonder if there is a better way to do it.
I have a main document class Main.as with a public static function called mainFunction().
ActionScript Code:
public static function mainFunction( _mc:MovieClip, _nVar:Number ):void
{
// do something
[Code]......
This can be tricky if the static function has many variables from its own class.
View 4 Replies
Jan 2, 2009
this is the code i found out on the web to call a function in the parent swf from the loaded child swf.
in the child swf:
Code: Select allpanel.next_mc.addEventListener(MouseEvent.CLICK, onClick);
function onClick(e:MouseEvent):void{
MovieClip(this.parent.parent).parentFunction();
}
[Code].....
View 6 Replies
Aug 27, 2009
How can I make a call to a function in the parent class of the class I'm in.
example:
main class
Code:
package {
import flash.display.Sprite;
public class mainClass extends Sprite
{
[Code].....
I realise that there is some stuff that is missing in the "full" code here, but that's just because I'm to lazy to write it all...
How do I get the "someButton" in the "child_class" to call the "theImportantFunction" in the main class? I know that it is possible to make a "dispatchEvent" in the "mouseClick" function, and then add a eventlistener in the main class.. But is there another way to just call the function directly?
View 4 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
Jan 12, 2010
I have a main MovieClip that creates a new instance of an imported class which is a page in the application. This class tries to call a function on the main MovieClip and it's not finding it. I've done this in the past without any problems with separate swf files and loaders, and with movieclips in a library. I'm at a loss on how to resolve this. Here's what I'm doing (simplified for posting):
[Code]....
View 5 Replies
Feb 23, 2009
I have a child movie clip attached to the parent via the flash interface. The child is running a timer via code on its (the child's) timeline. When the timer finishes it needs to trigger a function on the parent's timeline. All the examples show how to trigger a function on the child - that is easy and I have got that working.
View 1 Replies
Jan 21, 2009
syntax for calling a function (and sending arguments) located in an external SWF from a parent SWF?
View 2 Replies
Sep 23, 2009
this is the function i want to turn in to a static function. just dont know how to make it a static function and call it from other classes. i think this would have its own file.
[Code]....
View 2 Replies
Feb 4, 2009
[code]...
these are a couple of functions within a custom class i'm working on. why in the top function that when i call init() on the loaded swf, it works, but when i call reverseType() and normalType() in the second function, it doesn't work? i get a "TypeError: Error #1006: normalType is not a function." in the debugger. i've made sure those two functions are public in the document class, but nothing seems to work.
View 1 Replies
Aug 18, 2010
I have a swf called index it has the following [code]...
it traces the "why cant i see the loadswf function" How can I get it to call the loadswf
View 1 Replies
Feb 24, 2011
I have a swf that loads in another swf, in the swf that loads in I have a button that I want to call a function in the swf that loaded it in.
View 4 Replies
Nov 23, 2010
I've been working on this extremely annoying problem for over 3 hours!
Alright the basics: A parent movie, and a loaded movie.
Inside the parent movie on a frame where the loaded movie is loaded, are two functions[code]...
I have multiple functions and multiple ways to call them because I'm trying atleast for ONE of them to work! I have twisted this code, changed the functions, and tried so many different ways to debug this problem! And finally, I am showing you my most simplified way of testing this problem.
Normally, when I load my parent movie and once it loads the loaded movie inside it, if I click the button- it should call one of my functions. Then I should see the traced message in my output. Instead- nothing happens.
View 4 Replies
Apr 30, 2010
Can anyone tell me if its possible to call a function or class from within a loaded MC?
mainMovie loads MC > MC calls function in a class of mainMovie
if so, what is the best method?[code]...
View 2 Replies
Jan 7, 2005
is it possible to call a function in an externally loaded swf from _level0 ?I have "mySwf" with "myFunction" in it. I have "myMovie" which loads "mySwf" can I call this.mySwf.myFunction(); It dosn't seem to work for me...
View 3 Replies
Jan 7, 2005
is it possible to call a function in an externally loaded swf from _level0? [code]It dosn't seem to work for me..
View 3 Replies
Dec 2, 2010
I'm developing an AIR app that requires a menu to show only during the first run. In it the user will be able to choose the desired language for the app to run in.
I'm displaying this menu without a problem but I need it to stay visible until the "select language" comboBox is changed and then return the selected choice's data value.
how to return a value only after the combo box is changed.
function promptFRMenu():String{
FRMenu.enabled = FRMenu.visible = true; //when I detect the app is running for the
// first time, the dialog box is enabled
[Code]....
View 2 Replies
Mar 15, 2012
I have load child swf in parent swf, from child swf i am trying to run my parent swffunction I am trying this code
MovieClip(parent).testfun()
but this code is giving error.
TypeError: Error #1034: Type Coercion failed: cannot convert flash.display::Loader@2b1aa061
[code].....
View 1 Replies
Nov 25, 2010
Lets say I have a Main Document Class called Main. I also have a child class called childClass that call a function from the Main class and is also imported in the Main class. How should I call the function? I tried this , but when calling the function, it's getting me error.
Main class :
Code:
package {
import flash.display.Sprite;
import com.childClass;
[Code].....
View 6 Replies
May 13, 2011
Does anyone know the best method to trigger a function in the root from a dynamically loaded movieclip (loaded using addchild) using AS3, I understand targeting root is not the best way to do this?
View 2 Replies
Jul 15, 2010
I have small issue in as3. I am load "mainmenu.swf" file into "main.swf". through loader class. so now "main.swf" is parent "mainmenu.swf" file children how can call "main.swf " variable & function from "mainmenu.swf" .
View 2 Replies
Jul 30, 2010
I am trying to give a TextField a property such as:
Code:
field.debug = function(){ trace this.text; }
But it says: "cannot create property debug on flash.text.TextField"
What I want is to be able to make the 'this' keyword refer to the TextField. Is there another way of doing this?
View 6 Replies
Mar 16, 2010
I'm trying to make a timer..
When I press a button a movieclip does this: gotoAndStop(2);
I want it to go back to Keyframe 1 after 10 seconds.
How can I get this to work?
View 6 Replies
Feb 4, 2010
I found a lot of tutorials that show how to use getDefinitionByName() to create an instance of a class. Something like the following:
Code:
var classRef:Class = getDefinitionByName("menus.buttons.Icons") as Class;
var iconClassInstance:Icons = new classRef() as Icons;
[code]....
View 4 Replies
Jan 20, 2005
The easiest thing is if you look at my swf: [URL] Ive built a dynamic photo gallery which works from an XML database. The database contains the various gallery titles, the photo image paths and their captions.
The first page of the gallery is a thumbnail index page (lots of small preview images of the photos). The thumbnails load up one by one, they are only 1kb each but there are hundreds so takes some time. If a user clicks on one, the thumbnail movieclip is hidden with (._visible) and the photo page is shown, also with (._visible).
The problem is, the thumbnails are still being loaded in the background, so the chosen photo is not downloaded+shown until all the thumbnails have loaded. What kind of code do I need to place on the thumbnail's "onRelease" function to cancel the parent "make thumbnails" function ive made?
View 2 Replies