ActionScript 2.0 :: Using An Instance Name To Call A Variable?
Sep 25, 2007
I am using Flash2004 MX
I thought this would be simple, but it hasn't been.
I have a seris of hidden MCs named star1, star2 etc.
I want them to become visible when I call this function.
star_fn = function() {
starcount++
starshow=("star" + starcount)
starshow._visible=true
}
But it is not working.
I thought maybe it was like converting variable info to a number format, but using a text scenario instead.
View 5 Replies
Similar Posts:
Jan 23, 2003
Is it possible to call an instance of a movieclip by a variable name?
Say I have several movie-clips on the main timeline and a variable named "disabled". I want to click a button and have be able to tell "disabled" to goto frame 2, where disabled will contain the name of the movie-clip. can I do this?
View 3 Replies
May 25, 2005
I'm trying to reference an instance through the use of a variable in my call to a prototype. The variable is myVar and contains the instance name to which I want to apply the resizeTo prototype. My syntax is incorrect.
Code:
on(release){
//disregard this line
this.swapDepths(this._parent.getNextHighestDepth());
//this is calling a prototype named resizeTo
this.resizeTo(150, -100, -100);
//Setting instance name of another movie
myVar = "green";
//Trying to drop that instance name into my next prototype call
this._parent.myVar.resizeTo(100, _parent.old_X, _parent.old_Y);
}
View 2 Replies
Jan 26, 2009
I have a general / somewhat newbie question. Is it better practice to call a function from another class like so:
[Code]...
Does one way free up more memory or enhance performance?
View 5 Replies
Feb 12, 2012
I have a base class I've used on 6 different MC's. Then when I use these MC's my function runs an if statement to check which one to add.
if(id=design) var obj = new design();
if(id=team) var obj = new team();
I want to make it a bit more dynamic and use the id:String to evaluate which new instance to create.
ActionScript Code:
public function loadChapter(id:String):void {
var obj = new instance_of( id )();
}
View 5 Replies
Jan 7, 2010
As we know whent here is no such variable of null value assignment to a variable or instance flash throws this kind of Error.In one of my Application i need to get more flashVariables, They may or maynot come as FLASHVARS. But when i miss any variable flash thows this error as an alert box. is there any simple solution to avoid this kind of issue
when i use try,Catch statement the issue will not come, But i don't like to write Bunch of try,catch statement for all this kind of variables.
View 4 Replies
Nov 24, 2010
I want to monitor a variable. Whenever the variable value changes I want to call a function. In actionscript 2 I can use "watch" but in as3 what can do ?
View 1 Replies
Oct 27, 2008
How can I call the instance name of a mc? For example in AS2 I would do: this._name How do I do in AS3?
View 3 Replies
Aug 14, 2010
I have want to tell a movie instance to play from a class:
`package com
{
import flash.display.MovieClip;
public class Global extends MovieClip
[code]....
pic1m is the class, but I get 1120 undefined property error.If I just put pic1m.play(); in my main timeline action layer it works fine, but I need the function playMask to be global in AS3...
View 1 Replies
Feb 8, 2009
configuring this instance movie to play when i click a button, here is my movie structure:
- root movie - container and some external .swf movie
The process is there will be button load at the end of root movie, and calling some external swf movie with number. all the swf will play in a container each swf movie(about 5 animation)
At the end of root movie there is also some loop animation that play at the end of root movie, while we can click the button also.
What i want to do is how can i play the loop movie, start from the middle when i click one of the button.
So what happen will be: - click button = external movie load and the instance name play from frame 100 and loop again.
View 3 Replies
Jul 7, 2009
i have a main movie. i use a loader to load a "example.swf" file. then i place that file inside a holder movieclip. in example.swf, i have an instance of a class i just wrote. this class has some particular methods. from my main movie, i want to call the methods of the instance of my class i have in example.swf. how can i do that??? i know it's a kind of casting, but none seems to work.
View 1 Replies
Sep 16, 2009
How would you add a listener to an object inside of a movieclip that is in the library and as not been placed on the stage yet? Or, could you tell it to listen for when it does go on stage if it does come on the stage and when it comes on the stage to add an eventlistener to a movieclip inside of that?
View 3 Replies
Oct 15, 2009
From my Main class, in the method onBackgrLoad, I am trying to call a couple of public methods (i.e. xmlData, hintergrund & numOfProducts) located in LoadXML. I keep receiving an error message that "loadXML" is undefined. I dont understand why because I clearly defined it in the main class:
PHP Code:[code].............
View 2 Replies
Apr 27, 2009
When I try to use this code to call a function for every instance of a certain class I get an error saying that there is a "call to a possibly undefined method removeInstance through a reference with static type flash.displayObject".
Code:
for (var i:int=0; i<=numInstances; i++) {
if (numInstances!=0&&getChildByName("b"+i)!=null) {
getChildByName("b"+i).removeInstance();
}
}
View 2 Replies
Dec 7, 2010
I've created a button in my stage. I've set the instance name to init and have the MainTimeline being called from an an external script[code]...
View 2 Replies
Jan 3, 2006
I have 35 textboxes with the names "t1" to "t35". How would I call these names in a for loop? I have tried this with no luck:
[Code]...
I know I'm doing something wrong with the ("t"+i) but I dont know how how to combine a string and number like that.
View 7 Replies
Apr 8, 2010
one of my problem is that how do i call the instance name of a button from my child.swf to my parent.swf
i have four buttons from my child.swf where when i click btn1 it will load superchild.swf but i want to load that superchild.swf to my parent.swf, like instead btn1 calls superchild.swf to load, btn1 will call parent.swf then on parent.swf it will distinguish that btn1 was click from child.swf and it will now load superchild.swf.
View 3 Replies
Dec 28, 2003
I'm wondering how do u call a variable that has a variable name.
[AS]
max = 10;
For (i=1; i<=max; i++)
{
[Code].....
how can i do that? how do i address a variable name which is variable?
View 2 Replies
Sep 15, 2010
If an object, or say... a document class, creates an instance of a class (and stores it as a variable), and it doesn't pass any arguments to the constructor of the class, can that class object, by simply having a function of it called by the parent, tell who sent it that command/request? In other words, can a class object know who called it (such as it's parent) via a (seemingly) anonymous call?
View 1 Replies
May 21, 2008
how can i call all buttons within a certain movieclip (without naming each instance individually)?
View 5 Replies
Feb 8, 2009
How can I get the instance of the class to call the dispatchEvent for the postTrace function.
1180: Call to a possibly undefined method dispatchEvent.
Code:
package {
import flash.display.*;
import flash.events.*;
[Code].....
View 1 Replies
Nov 4, 2011
Say i have a movieclip named a_Mc ( ClassA ) I have a sub-movieclip named b_Mc ( ClassB )
CASE 1: Accessing the sub-movieclip b_Mc which is already present inside the a_Mc movieclip
( Since Flash IDE has "Automatic instance naming" OFF )
ClassA mentions the name of b_Mc as => var b_Mc:MovieClip;
NOTE HERE: That the variable name MUST BE same as the name of the instance on stage.
So i can access it as : trace( a_Mc.b_Mc);
[Code]...
View 1 Replies
Sep 20, 2009
I just want to ask if is it possible to call a movieclip using the String Class together with it's instance name to use gotoAndPlay() method. I know how to use the instance name and the method but then what if I want to use a string together with the instance name and the gotoAndPlay.
View 1 Replies
May 6, 2011
Ok, I've been at this for 2 days now, and really need some assistance. It seems like it should be so simple!
The part that doesn't work [code]...
Then that button in the root should be able to take the value that is in the variable "critter_pressed_new" and use that as the instance name, to make that particular mc go away.
View 2 Replies
May 31, 2010
Simple question: I'm trying to use a variable to call on different instance names:
[Code]...
The code in red is the issue in question. In this example, I'm trying to add a child called "pic_2", with the number two called from the variable "picCaller"
View 16 Replies
Jan 17, 2009
I have multiple inputs which I would like to limit the input on. Not limit to number of characters but limit to the actual input box. The problem is the limit script is not reading the variable I am sending to the function and is returning as undefined.
ActionScript Code:
function Limit(SetText){
oKey = new Object();
var __text0:String = "";
[code]....
View 0 Replies
Dec 3, 2009
I am trying to create an animation that will cycle through letters (each of which have an instance name) by using a loop. I have a variable which it outputting the numbers i need if just used in a tract but i want to add it to the end of the instance name so that each instance scales one after the other. Any way of delaying each one by a few few seconds (or milliseconds if I remember the acrionscript unit of time correctly).
View 3 Replies
Feb 1, 2010
Basically I am having errors when trying to use a variable to set my instance name.
Here is the code:
ActionScript Code:
var i:Number = 1;
["button"+i].transform.colorTransform=myColorTransform; //doesn't work
button2.transform.colorTransform=myColorTransform;//works
'i' will always carry the button number.
I've tried all the methods I can think of so I am hoping that one of you can give me a hand, if I can figure this out I can probably save a few hundred lines of code in an app I have just started on.
View 3 Replies
Jul 19, 2006
How do I get the name of an instance and use it as a variable?
Something like:
my_name = getInstancename(this);
View 1 Replies
Nov 17, 2010
I'm trying to use a variable to call on different instance names:
var picCaller:uint=2;
material_mc.addChild(pic_""+picCaller+"");
The code in red is the issue in question. In this example, I'm trying to add a child called "pic_2", with the number two called from the variable "picCaller"
View 2 Replies