ActionScript 3.0 :: Accessing Mc Functions From The Root?
Sep 22, 2009
How can i access a function that is in a movieclip from the root?
i've tried these :
mcName.functionName();
MoviClip(mcName).functionName();
but all of them didn't work at all.
View 1 Replies
Similar Posts:
Apr 16, 2009
here's my problem/code:
I have a mc in the main timeline named contactBox_mc, within this mc I have another mc named closeBtn_mc. I have added an EventListener to closeBtn_mc to set the visibility of contactBox_mc to false on MouseEvent.Click.. but no matter what method I try, I get the following error:
1180: Call to a possibly undefined method contactBox_mc.
This is the code I placed within closeBtn_mc to set the visibility of its parent movie to false:
closeBtn_mc.addEventListener(MouseEvent.CLICK, closeBox);
function closeBox(e:MouseEvent):void{
contactBox_mc(this.parent).visible = false;
}
I also tried: root.contactBox_mc.visible = false; and got the same error,
View 4 Replies
Jan 9, 2010
I'm having trouble accessing the value of the root node of an XML variable in flex. For example:
[Code]....
I can change the "Type" attribute above with X.@Type="xyz"; But how do I change "Content123" to something else? If the xml document were longer/deeper, I could say something like X.Entry[11].Cost=2.22; But what do I say in this case? Obviously X="Content456" doesn't work...
View 4 Replies
Mar 4, 2012
I have a SWf application built in flex 4. One part of the application relies on accessing a public variable ("step1") set at the application root, and is accessed with
var app:Object = FlexGlobals.topLevelApplication;
trace("step one is "+app.step1);
This, while not optimal, has worked fine. Now, hoever, I need to load this entire application into another application, and I can't figure out how to access my step1 variable any longer.I have been loading the swf into the new parent application like so:
public var myLoader:Loader = new Loader();
public var pizzaContainer:UIComponent = new UIComponent();
private var myUrl:URLRequest = new URLRequest("chickensoup.swf");
[code]......
View 1 Replies
Sep 10, 2008
Even though i know not much of actionscripting, i like to make sites that are flash-based, so i keep on challanging myself with that. But now i stumbled into something, and i just cant find a solition! here is my problem: I have made dropdownmenu's in a movieclip and the mc works with hittest like this:
[Code]...
View 1 Replies
Jun 30, 2009
I have a 13 movieclips within another movieclip which in turn is placed on the root timeline. I have written a function in the actions layer of the main timeline:
function illboxClear(){
_root.illpre.ill1.gotoAndStop(1);
_root.illpre.ill2.gotoAndStop(1);
_root.illpre.ill3.gotoAndStop(1);
_root.illpre.ill4.gotoAndStop(1);
[Code] .....
It sends the animation in each of those described movieclips back to frame one as you can see. When I try to call the function from actions on a button which itself within a separate movieclip placed on the stage:
on (rollOver) {
illboxClear();
_root.illpre.ill2.play()
} on (rollOut) {
_root.illpre.ill2.play()
} on (release) {getURL("boxer.html","_blank");
}
It doesn't work! Can I not call functions from button objects or have I made some other elementary error?
View 7 Replies
Mar 23, 2007
I'm trying to change the text on a textbox called "text1" that is part of a movieclip called "menulist" using actionscript. How can I access text1 with actionscript?[code]
View 6 Replies
Dec 10, 2007
My flash project is structured as follows, with the nested external swfs being loaded to clip holders using loadMovie():
home.swf
|--sponsors.swf
|--educators.swf
In home.swf, I've defined a text box with instance name contentWindow_txt, and assigned its path to _root.cw_txt. Now, when I type the following anywhere in home.swf:
Code:
_root.cw_txt.htmlText = "testing!";
The dynamic text box contentWindow_txt will display "testing!" when the swf loads. Unfortunately, when I make the same call in sponsors.swf, I get nothing. Is there something about external swfs or variable inheritance I don't know?
View 9 Replies
Feb 18, 2008
I have some variables declared on the root timeline that I need to access from some MovieClips. In AS2 I would do something like this _parent.myVar from within my MovieClip. I intend on getting fully up to speed with AS3 but right now I need a quick fix.on the root timeline I have a variable : var myHitTest:Boolean = false;My MovieClip needs to access this var so I tried it several ways listed here. I've had no success.
parent.myHitTest:Boolean
root.myHitTest:Boolean
Stage.myHitTest:Boolean
[code].....
View 6 Replies
Jul 23, 2009
I am able to access main root from an external swf by doing this:
MovieClip(root.parent.root)
but how to avoid getting an error when testing external swf alone? Is there any try catch system I can do to avoid thoses errors?
View 1 Replies
Aug 17, 2009
im attempting to keep it as portable as possible so its easier to edit later, and i dont have to go around copying/pasting too much code. - i'll cut to the chase..
On my main timeline, i load all the image-file names, as variables.. using loadvars into thumbnails, which ive given instancenames Loader_1 to Loader_20, inside these thumbnails is the Loader component Thumb_1. Here is the code on the main timeline, to load these variables.
Code:
BigLoader._visible = false;
var my_lv:LoadVars = new LoadVars();
// load variable function
[Code]....
how i could make this more portable without -completely- changing the format its in [so i can still understand it]
View 9 Replies
Jun 13, 2009
Basically I have a _mc that I am calling in from the library. When I get to the end of the clip I want it to advance the root time line to frame 3.This is the code I have at the end of the _mc
MovieClip(root).gotoAndStop(3);
This is the error I get :Error #1009: Cannot access a property or method of a null object reference.at introScene/frame91()
TypeError: Error #1034: Type Coercion failed: cannot convert flash.display::Stage@44370ba1 to flash.display.MovieClip.
View 2 Replies
Nov 15, 2010
I have declared a object in my 1 st frame of application.
ActionScript Code:
var objTest:Test = new Test();
I am tring to access the object from a movie clip. Movie clip is located in frame 2. I am getting error
ActionScript Code:
this.parent.objTest.IncrementCount();
trace(this.parent.objTest.QuestionCount);
1119: Access of possibly undefined property objTest through a reference with static type flash.displayisplayObjectContainer.
How to access a object instantiated at root from a movie clip.
View 1 Replies
Feb 25, 2010
I have declared a object in my 1 st frame of application.
ActionScript Code:
var objTest:Test = new Test();
I am tring to access the object from a movie clip. Movie clip is located in frame 2. I am getting error
ActionScript Code:
this.parent.objTest.IncrementCount();
trace(this.parent.objTest.QuestionCount);
[code].....
View 4 Replies
Nov 16, 2010
I have declared a object in my 1 st frame of application.
ActionScript Code:
var objTest:Test = new Test();
I am tring to access the object from a movie clip. Movie clip is located in frame 2. I am getting error
ActionScript Code:
this.parent.objTest.IncrementCount();
trace(this.parent.objTest.QuestionCount);
[code].....
View 3 Replies
Sep 14, 2010
I would like to ask on how do you access a child's function in AS3 I have tried "ChildMovieClip.childfunction();" so far it does not work.
View 3 Replies
Jul 14, 2010
I'm trying to create a JW player plugin, a part of the source code is shown below:
public function initPlugin(player:IPlayer, config:PluginConfig):void {
api = player;
var streamUrl:String = 'xxx';
[code].....
View 1 Replies
Jan 15, 2009
I'm working on a flash video player and I'm trying to figure out how to access something inside the constructor that I know is set but it keeps telling me its not.
[Code]....
now in the metadata function its giving me the error, "Access of undefined property video" Now, am I just completely not understanding how classes work or is this a common problem?
View 4 Replies
Jun 30, 2010
I have a file which loads a series of SWFs. It loads one, allows it to play to completion, then stops. Right now, it will just wait for the user to press a button and select the next one. However, I need it to play them sequentially. Is there any way for the SWFs which get loaded to access the functions which control the SWF loading?
View 4 Replies
Sep 8, 2011
I've been working my way towards better OOP design lately and I've come across a problem with accessing functions in other classes from my Main class. Here is the code:
Main.as
ActionScript Code:
stage.addEventListener(KeyboardEvent.KEY_DOWN, onKeyDown);
stage.addEventListener(KeyboardEvent.KEY_UP, onKeyUp);
stage.addEventListener(KeyboardEvent.KEY_DOWN, fireBullet);
They are listening for functions that are within the Player.as class, these functions control the dynamics/movement of the player itelf. But for some reason I'm getting a 1120 error(access of undefined property). Basically how do you listen/access for functions within a different class?
View 5 Replies
Sep 8, 2008
I'm sorry if this has been answered 1,000 times, but I am so confused with everything!! In the main timeline of my movie, I have a container movieclip called "content". I want to load an external swf into content, and then access the functions in that swf. I can load it no problem, but I can't for the life of me figure out how to access the functions, I can't seem to find it anywhere!
View 3 Replies
Nov 21, 2005
I'm creating a soundboard, and and I've been using Flash for about 2 weeks and Actionscript for about a week, so you'll have to excuse my ignorance. I've used google to look for specific things to no avail so here I am.Okay, so, I have a soundboard that, when pressing a button, it will hide or show certain buttons on the page, to give the feeling of multiple pages. All my visibility stuff works like a champ.
Right now, in the working version of my soundboard, I'm not using functions to instantiate my linkable objects, create the array, or populate the array to hold the linkable objects. I would like to use functions to make my code less obtuse. I looked around for a while trying to figure out how to pass an array of objects into a function but i haven't had much success. I'm not quite sure if it's even possible to do. These are the errors I get:
1120: Access of undefined property playArraySound001.
1061: Call to a possibly undefined method play through a reference with static type Class.
1120: Access of undefined property playArraySound001.
1120: Access of undefined property GordonSoundArray.
1136: Incorrect number of arguments. Expected 1.
The first code is what works, the next code is the stuff that doesn't work.This is the working version
Code:
//////////// CODE FOR PLAYING SOUNDS
//// This is creating an instance of the Linkable object
var playArraySound001:Link_10_minutes = new Link_10_minutes();
var playArraySound002:Link_3_eggs = new Link_3_eggs();
[code]....
View 5 Replies
Aug 1, 2004
how to access variables that are declared in a movie clip from a function declared in that same movie clip.
i.e.
****************************
var int1 = 1
var int2 = 2
[Code]....
I'm trying to do this in the main movie clip of a movie that I plan on importing dynamically in another movie. I've tried to use this.int1++, but I think that flash was looking for a variable that belongs to "myfunction" when I did that. I could just use _root.int1++ but like I said, I plan on dynamically loading this into another movie, in which case it would be pointing to the wrong movie.
View 2 Replies
May 29, 2010
how can i call public functions or vars of a sprite class from another class (or frame script)? i keep getting 1061: Call to a possibly undefined method getSide through a reference with static type flash.display:Sprite.
//Framescript
var a:Sprite = new customRect();
addChild(a);
[Code]....
View 2 Replies
Aug 29, 2010
I use the following jQuery code to access functions in my SWF (FP 10.1 SWF embedded via SWFObject): $('#FlashApp')[0].someFunc(); This works fine in every browser.. except for Internet Explorer (surprise!). Surely, the point of jQuery is to make this code work across all browsers? I'd really rather not write extra code to check for IE. How can I talk to my SWF in a browser independent way?
View 3 Replies
Sep 9, 2009
I've made two custom classes ("banana" and "box"). As I start my application I create two new objects from these classes - first I create a banana object and then a box object. The banana class/object has a property/variable ("weight") that I set with information from an external XML file, thus it takes a while for it to receive a value.
My problem is that my box object needs to access the "weight" property of the banana project, just after the box object has been created. The problem is that the banana object hasn't finished initialising when I make the request from the box object...
Is there a way of either check the status of another class (initialisation status that is), or is there another way of preventing the box object to either be created before the banana object is initialised?
View 2 Replies
Oct 24, 2009
I'm creating a soundboard, and and I've been using Flash for about 2 weeks and Actionscript for about a week, so you'll have to excuse my ignorance. I've used google to look for specific things to no avail so here Okay, so, I have a soundboard that, when pressing a button, it will hide or show certain buttons on the page, to give the feeling of multiple pages. All my visibility stuff works like a champ.
Right now, in the working version of my soundboard, I'm not using functions to instantiate my linkable objects, create the array, or populate the array to hold the linkable objects. I would like to use functions to make my code less obtuse. I looked around for a while trying to figure out how to pass an array of objects into a function but i haven't had much success. I'm not quite sure if it's even possible to do.
[Code]...
View 0 Replies
Mar 26, 2010
I'm trying to make a button that gets it's getURL address from an external text file. So, I load the text file and assign it to a variable:
[Code]....
View 5 Replies
Dec 14, 2004
Short description of my project:I'm making a "flash-car-damage-registration-program" where a user can click on a part of a car, make two choices (from two comboboxes) that describes the damage, and then save it in a datagrid withing flash.I have split up the code in different class files:I have a damage.as class file that describes the damage and its properties.I have a carPart.as class file that extends the Movieclip class. This sets all the propertiesof each carpart and where the roll-over/out eventlisteners are, pluss som escriptive text to each carpart. This works the way I want it to. This is just to quickly give you an idea of what I'm working on.So to the real question or problem: I have a LoadMyXmlData.as class file where I load some xml data, this works fine. A function in this class takes a combobox and a xmllist as parameters.
I want to populate the mentioned comboboxes from the xml data. Both comboboxes are on the stage within another movieclip, but I can seem to access them. (yes, they have instancenames etc) I get error 1120: 'Access of undefined property'. I have tried ways like: containingMc.comboboxMc' and so forth but no luck. I have been searching the web for days for a solution to my problem, but nothing so far.
View 1 Replies
Jun 22, 2009
How can one class access a nested function in another class.Examplish.
Code:
main class{
public function main(){
[code].....
View 3 Replies