ActionScript 3.0 :: Targeting A Parent's Function?

Aug 13, 2009

I've created a Preloader.as class. When the preloader finishes loading, I'd like it to call a function from it's parent (the document class).This is the error I get:

Code:
1119: Access of possibly undefined property startApp through a reference with static type flash.display:DisplayObjectContainer.

[code].....

View 9 Replies


Similar Posts:


ActionScript 3.0 :: Targeting Parent Of Clicked MC?

Feb 2, 2011

this one's driving me crazy. I've got a button embedded in a MovieClip. When the user clicks the button (from the stage level), I want to return what MC the button's parent is, so that I can pull some variables from the parent.

HTML Code:
public function buttonClicked(e:MouseEvent)
{

[code].....

View 1 Replies

ActionScript 3.0 :: Targeting A Parent Movie Clip?

Mar 18, 2010

this is weird, ive tried all my resources and cant come up with the solution.

heres the heirarchy

Main Stage

sampleStage_mc (this contains all my samples)

sampleStageNavigation_mc (this is the movieclip that houses my buttons)

............................................

what i want to happen is when you click on one of the button_mc, i want it to target a frame label on the "sampeStage_mc" timeline.

heres my code:

Actionscript Code:
toshibaBtn_mc.addEventListener(MouseEvent.CLICK, toshibaSample);function toshibaSample(evtObj:MouseEvent) {    parent.gotoAndPlay("toshiba");}


theres four timelines, here is the outline

button_mc (i click this and it runs the code in sampleStageNavigation timeline)
sampleStageNavigation_mc (timeline that holds the ActionScript and the button_mc)
sampleStage_mc (timeline - this is the one I need to access)
main stage (timeline)

View 10 Replies

ActionScript 3.0 :: Targeting Parent Swf Holder Mc To Load New External Swf?

Dec 1, 2009

I have a main swf that loads external swfs into a holderMC. How do I get a button called playnext_btn on each external swf to tell the main swf to load a new external swf into its holderMC? I used this code in the main swf to do the initial load of the first external swf into holderMC:

Code:
var swfLoader:Loader = new Loader();
holderMC.addChild(swfLoader);
var bgURL:URLRequest = new URLRequest("benefits.swf");

[code]....

View 3 Replies

ActionScript 2.0 :: Targeting Buttons Parent Versus Root?

Feb 19, 2010

I have a main flash movie that loads three external movies, the external movie buttons don't work when loaded onto the stage.
In each external swf thats loaded, the button actionscript is in this form:

HTML Code:
on(release) {
_root.gotoPage(2);
}

And this works when each swf is loaded stand-alone. But not when loaded as an external swf.With the numbers ranging from 1-19 as far as pages. How should I edit the code so that these buttons work when loaded externally?

Code:
on(release) {
_parent.gotoPage(2);
}

[code]...

View 0 Replies

Actionscript 3.0 :: Targeting Parent Swf HolderMC To Load New External Swf?

Dec 1, 2009

I have a main swf that loads external swfs into a holderMC.

AS3

How do I get a button called playnext_btn on each external swf to tell the main swf to load a new external swf into its holderMC?

I used this code in the main swf to do the initial load of the first external swf into holderMC [code]...

View 6 Replies

ActionScript 2.0 :: Targeting Function Within MC?

Jul 14, 2006

I am trying to start and stop an animation from outside of the main timeline. I have written the functions inside the movie to start and stop the animation and they work fine when called from within the movieclip but when I call them from the maim timeline I get nothing. I have checked the targeting is correct and can't think what this is

View 6 Replies

ActionScript 3.0 :: Access A Function Within A Function In A Parent Swf From A Loaded Swf?

Jul 29, 2010

Is it possible to access a function within a function in a parent swf from a loaded swf?

View 6 Replies

ActionScript 3.0 :: Targeting - Dynamically Create A Few Instances Of The ComboBoxButton To Function As The Drop Down Submenu

Jun 24, 2009

I've created an MC in my library (comboBoxButton) which holds 2 MCs, text_mcl and bg_mcl. I dynamically create a few instances of the comboBoxButton to function as the drop down submenu: PHP Code:

[Code]...

When one of the buttons is selected it sets a variable on the root. I'm running into trouble targeting the MCs text_mcl and bg_mcl inside the instance of the dynamically created comboBoxButton. PHP Code:

[Code]...

View 1 Replies

ActionScript 3.0 :: Positioning Parent MC In Order To Center Child MC On Parent's Parent MC

Feb 5, 2010

[code]All clips are squared.Ok, on the PlayerPlane, there are little soldiers, which have hotkeys. The effect I'm trying to create is I want to position the GameStage so that the currently selected soldier appears in the center of the GameClicker clip.The GameStage is movable by the player (to scan other areas of the map)by holding the CTRL key, so it's easy to kinda lose track of where your players are.I have tried using localTo Global and globalToLocal techniques, but I think I'm lost on the actual math of getting the GameStage to move the correct distance so that the selected soldier is centered to the GameClicker.[code]

View 2 Replies

ActionScript 3.0 :: Grabbing The Parent Of A Function?

Mar 23, 2009

I'm having trouble adjusting to the way functions pass in AS3. How come when I say "this" it doesn't know I'm refering to AudioTrack?

PHP Code:

var AudioTrack:Object = new Object();
AudioTrack.myVar = "Hello";
AudioTrack.onComplete = function(){

[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 3.0 :: Call Function In Parent

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

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 2.0 :: Access A Function Of The Parent Of An MC?

Oct 5, 2005

Well- actually, my problem is a bit more abstract than this thread's title suggests..ere's the setup:I have a parent function (called "Game") with a couple of subfunctions.There is one subfunction ("Game.prototype.spawnBonus") that, as the name suggests, spawns a Bonus Item by duplicating a movieclip.The duplicate movieclip is created on "_root"-level and has an onEnterFrame attached to it that checks whether a certain stage is met (all this works).Now the problem is, when the case is met, I need to access a subfunction of "Game" and pass it the MC's ID to fade out the Bonus Item. Like so:[AS]Game.prototype.fadeBonus =

function(number) {
// just some stuff to fade out the MC with the number
// passed through the value "number". This works well,

[code].....

View 3 Replies

AS 3 :: Child Call A Function In Its Parent?

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

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

IDE :: Why Does Parent Correct Function Not Working

Sep 19, 2009

In actions in my .fla file I create a new object of a class (addChild) which is in an separate .as file. Now, in my .as file I want to call a function in the .fla file. This should be the parent right? So, I try parent.correct(); which does not work. I get the error #1061 (call to a possibly undefined method). However, when I do this:
var par:* = parent;
par.correct();
Everything works. Why is this?

View 3 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

ActionScript 3.0 :: Get Parent To Execute Function In Child?

Jun 22, 2009

I have a function in a child that I need to have executed by the parent but I can't get it to work. Does anyone know how to call the function in a child from a parent?

What I'm doing is having the parent load a few buttons and I want to re-use the button swf, but have the parent provide the text for the button.[code]...

View 20 Replies

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 :: Accessing Parent Function From Class?

Nov 17, 2011

I have a .fla file with some code in the actions panel.A bit of code calls a function in a class from the actions panel .The function in the class is run, but I want to be able to call a function in the main actions panel code from the function in that class .The class doesn't extend anything so (parent as MovieClip).function() does not work.

View 7 Replies

Flex :: Call Parent Function From ItemRenderer

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

AS 3.0 :: Flash - Reference Parent Class Function?

Mar 23, 2010

I am trying to run a function of the main class, but even with casting it does not work. I get this error

TypeError: Error #1009: Cannot access a property or method of a null object reference.
at rpflash.communication::RPXMLReader/updateplaylist()
at rpflash.communication::RPXMLReader/dataHandler()

[Code].....

View 2 Replies

Flash :: EventListener Function In Parent Class?

Jan 7, 2011

I have class ShowCase that inherite from my class ContentMC (that inherite from MovieClip). In the class ShowCase I have an EventListner that calls a function in the parent class ContentMC. But I get an error that says "Access of undefined property restoreMenuItem".

This is my eventlistner in ShowCase.as.

showcaseItem.addEventListener("CONTENTMCCLOSED", restoreMenuItem);

Here I get the error, it doesn't find the function restoreMenuItem.

The function restoreMenuItem is in ContenMC and looks like this.

public function restoreMenuItem(evt:Event):void
{
}

How do I call this function that's in the parent?

View 1 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

ActionScript 3.0 :: Access Child.swf Function From Parent.swf?

Dec 22, 2008

I have to access a function in child swf from parent swf. This child swf gets loaded into a canvas object in parent.swf. Everything works fine but I'm unable to call any function that was in child.swf. My code is

Code:
var swf1:SWFLoader = new SWFLoader();
swf1.source = "CHILD.swf";
can.addchild(swf1);

I read on google and then I tried this in parent.swf's code

Code:
var myrequest:URLRequest = new URLRequest("CHILD.swf");
var myloader:Loader = new Loader();
myloader.load(myrequest);
canvas.addchild(myloader);

Now this one throws up a runtime error TypeError: Error #1034: Type Coercion failed: cannot convert flash.display::Loader@5934b01 to mx.core.IUIComponent.

I also tried this

Code:
var myrequest:URLRequest = new URLRequest("CHILD.swf");
var myloader:Loader = new Loader();
myloader.load(myrequest);

[Code]....

But in this case my swf does not show up at all and there are no runtime errors too!

How do I resolve this error and how do I then access the function in child.swf?

View 9 Replies

ActionScript 3.0 :: Call A Function From A Parent Class?

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







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