ActionScript 3.0 :: Using Variable Name As MovieClip Name?

Dec 18, 2009

i have two strings and i wish to use the value of these to firstly, name the new movieclip and secondly, use it to call the class name in Linkage. is it possible? so far i've tried this.

var [pageName].MovieClip = [page]
addChild[pageName];
and get the error message "1084: Syntax error: expecting identifier before leftbracket."

[Code].....

but as this is the same name as the variables it throws up an error message..

"1086: Syntax error: expecting semicolon before dot."

View 7 Replies


Similar Posts:


ActionScript 2.0 :: Flash8 Variable Set-up - 'if' Statement To Run From Variable When Playhead Encounters MovieClip

Aug 21, 2009

I want to declare a variable on the main timeline that can be called from anywhere in my movie. So, _global var should be the right approach. I want to declare a movie clip 'MC1' "open", or "closed" so that when it is revisited, my flash file knows the user has been there before and performs a different task from the one it does when 'MC1' was first encountered. So, i need a 'if' statement to run from the variable, when the playhead encounters the movieClip.

[Code]..

View 2 Replies

ActionScript 3.0 :: Change String Variable To A MovieClip Variable?

Oct 10, 2008

I have been banging my head against a brick wall regarding the following problem which must be very simple to fix, just can't see the answer.I have a class assigned to a movieclip called canvas. The class is called drawClass. I have called the instance of canvas on the stage 'drawingCanvas'.When I trace "drawingCanvas" I get object drawClass] which is fine. Tracing drawingCanvas.name gets me the instance name 'drawingCanvas'.This is a String variable.Basically what I am trying to do is pass the MovieClip name to another class. In my example the class 'toolBar', which can then interact with the MovieClip.

The problem is passing 'drawingCanvas.name' results in a String, so I get an error saying :TypeError: Error #1034: Type Coercion failed: cannot convert "canvasArea" to flash.display.MovieClip.I can't for love or money find a way to convert a String variable to a MovieClip variable! I have the name of the MovieClip, I just need to tell the toolbar class. But I can't find a way of doing this as the instance on stage is an object of drawingClass, not a MovieClip (unless MovieClips with attached classes are not treated as standard MovieClips?).

View 9 Replies

ActionScript 3.0 :: Movieclip Inside Movieclip Variable Not Defined

May 17, 2011

I am brand new to AS3 and just about muddled through with AS2. I have a problem which should have a simple solution but everything I try gives errors.I had a load of buttons on the main timline which worked fine. I have moved a load of them into another movieclip called flyoutMenu. Now none work and I get the error:Error #1065: Variable about is not defined.This is the code stripped down to one button:[code]

View 2 Replies

ActionScript 3.0 :: MovieClip Accessing A Variable That Is In A Function Outside Of The Movieclip

Dec 8, 2010

I am trying to access the variable myParentVariable within the function myParentFunction() from the MovieClip's myMovieClip_mc function myMovieClipFunction().
 
I know that It works if I declare the variable myParentVariable outside of the myParentFunction() but I don't really want to do that

main timeline
//-------------------------------------------------------------------- ---
myParentFunction();
function myParentFunction():void

[Code]....

View 1 Replies

Use A Variable And Then AddChild With A RemoveChild For The Old MovieClip After The New MovieClip Has Loaded

Mar 30, 2009

This is something I'm experimenting with, but haven't seemed to figure out... I have several MovieClips, basically the same, only different colors. As each one plays, I'd like it to "overlap" whichever one is already there. Right now I have each button linked to a gotoAndPlay function, but I don't think that will ever get me what I want. You can see how I have it now here: [URL]

Instead of having the content MovieClip go back to all white when a button is clicked, I'd like the preivious one to remain, and get "covered up" by the new one. You continue to see the old color, and the new color overlaps it. I have a feeling I need to use a variable and then addChild, with a removeChild for the old MovieClip after the new MovieClip has loaded, but I'm not getting any good results yet.

View 1 Replies

ActionScript 2.0 :: Send The Variable X To Each Movieclip So That It Can Be Called From Within Each Movieclip Instead?

Aug 1, 2005

I have a loop that creates movie clips where the movie clips are named mc_+ x for say x = 1 to 10 so the movieclips are called mc_1, mc_2.....mc_10.

What I need to do is the know which one of the movieclips is clicked on but more importantly the number i.e if movieclip mc_2 is clicked on then I need to use the value 2.

At the moment I am sending the value of x to be displayed in a text box within each movieclip:

_root.search.textfield.text = x;

Then I have a piece of actionscript that uses the value of x but I don't seem to be able to "re-read" the value of x back with:

var t = _root.search.textfield.text;

what I want is t = x is it to do with strings and number variables?is it possible to send the variable x to each movieclip so that it can be called from within each movieclip instead?

View 1 Replies

How To Create Variable That Contains MovieClip

Aug 8, 2009

I want to create several "buttons" (which are actually MovieClips) that are all identical apart from an image and the link. My thought was to create a movieclip button that contains a var that will represent a movieclip, then in each instance of the movieclip button set that variable to be the movieclip image that will correspond to the button.

Geez my query seems so simple until I try and put it into words...The gist of it is, how do I name a movie clip variable? Something like, in the main movieclip, instead of inserting a specific image into the movieclip, insert a variable named innerImage, then in each instance of that movieclip name the image to be inserted by specifying the variable

var innerImage:MovieClip = the movieclip I want for this instance.
If the var was a number, it would just be:
var innerImage:number = 4;
If the var was a string:
var innerImage:string = "word";
So for a movieclip:
var innerImage:MovieClip = ???

View 10 Replies

ActionScript 3.0 :: MovieClip In A Variable?

Oct 28, 2009

I have four buttons currently set up to do all sorts of stuff in a flash file. What I'd like to do is have them all point to the currently displayed movie clip on my main timeline.

At the moment they're set up to test the addChild and removeChild functionality I've written and it seems ok. I would like to trigger removeChild and addChild by the last frame in a movie clip and have my buttons send a play command to my movie clip. That way the clip plays to the end before removing itself and adding a new movie clip.

The movie clip that I would like to trigger the addChild and removeChild functions is actually one of four movie clips so I need to declare play(); and send it to the current movie clip regardless of which one is on the stage.

[Code]...

View 1 Replies

CS3 Access A Variable Within A Movieclip?

Feb 3, 2010

I have a button inside a MovieClip (instance name: bt_fechar) and I want to refer to it from the main timeline (that's where I want to keep most of the code). It returns the following output error message: "Error #1065: Variable bt_fechar is not defined"

Heres the code:
function retirarCiclo(event:MouseEvent):void
{

[code].....

View 1 Replies

Variable Used In Movieclip Control?

May 2, 2011

I am very rusty on my actionscript but here is my issue.I am declaring a variable:var activeTab = "none";the using the varible in a function the variable is working and holding the name of the movie clip that was clicked:

function moveTabs(event:MouseEvent):void {
if (activeTab == "none"){
activeTab = event.target.name;

[code]....

View 1 Replies

ActionScript 3.0 :: Using Variable As Name Of MovieClip?

Jun 10, 2011

So say there are 10 movieclips on the stage, each named mc1 mc2 mc3 etc. In a public class I have a function that sends the name of a movieclip and I need to be able to change the frame of that movieclip based on the string that is sent. So say my class function declaration is:
moveFrame(theMovieClip);
Where theMovieClip is the returned object from another function. Is there any way to use that variable somehow? The concept of what I'm trying to do:
function moveFrame(s) {
s.gotoAndStop("the right frame");
}

View 4 Replies

AS3 :: Use One Variable To Load All Movieclip?

Apr 11, 2012

is there a way to make all the movieclip that I want to load on stage into an array?

if (selectDiffText.text == "Collection 1 Easy")
{
var c1_easy:cartoonEasy = new cartoonEasy();
addChild(c1_easy);

[Code]....

now I have 3 movieclip in library which is cartoonEasy, cartoonMedium and cartoonHard. I'll add one of them into stage but with different variable. is it a way I can make them just using ONE variable only? is it using array?

because if just using 1 variable then i can easily control object inside 1 of the movieclip that I called from library.

what I'm thinking is like this:

var c1_all:cartoonAll = new cartoonEasy() = new cartoonMedium() = new cartoonHard()

View 2 Replies

ActionScript 2.0 :: Variable As MovieClip Name?

Jun 25, 2010

ActionScript Code:
<MovieClip>.colorTransformTo(ra, rb, ga, gb, ba, bb, aa, ab [, seconds, animation type, delay, callback, extra1, extra2]);

[code]......

View 2 Replies

ActionScript 2.0 :: [fmx] Getting A Variable From A MovieClip Name?

Jan 28, 2004

what's the best way to get a variable when a button or movie clip is clicked that corresponds to a part of the name of the clip?

let me explain...say i have four movie clips, clip01, clip02, clip03 and clip04.

[code]...

View 3 Replies

ActionScript 2.0 :: How To Use Variable To Name MovieClip

Mar 19, 2004

I am trying to duplicate a move clip and then set some of it's properties with actionscript. What's the notation to do this?
Here is my guess:
Code:
duplicateMovieClip(_root.event, ("event"+i), i);
[event+i]._y = ([event-i]._y)+([event+i].height);
[_root.event+i].eDate = ("4/2"+i);
trace([_root.event+i].eDate);

View 4 Replies

ActionScript 3.0 :: Movieclip's Name As A Variable?

Nov 2, 2009

I have one horse animation in the library.I have made 6 instances of the Horse() that's in the library named:

horse0_mc
horse1_mc
.......

[code]....

View 4 Replies

ActionScript 2.0 :: Get A Variable From A MovieClip Name?

Jan 28, 2004

What's the best way to get a variable when a button or movie clip is clicked that corresponds to a part of the name of the clip?[code]...

View 3 Replies

ActionScript 3.0 :: Passing A Variable To MovieClip?

Jul 30, 2009

I am trying to send a value from one of my xml nodes (<marker>) by declaring it in a function 'showData' as a variable 'XMLMarker'. If I trace this value (XMLmarker) it returns the right data found in the node <marker> (which is 'myMarker_mc'). However, I need to tell the stage that myMarker_mc is a MovieClip...please see the 'PROBLEM' stated in the code below.

Code:

stop();
var placesXML:XML =
<places>
<place name= "Yogyakarta">

[code]....

why do you want a variable to hold the value in the node <marker>, when that value is identical for each node, ie. it is always 'myMarker_mc', so why not just directly declare the variable 'xmlMark' as myMarker_mc. The reason is; the value in some of the <marker> nodes will soon be changing to 'myMarker_mc2' - a slightly different movieClip which I may need to call depending upon which place @name is chosen.This is the new output thrown up by the variable XMLmarkers

Code:
<marker>
myMarker_mc
<myText>

[code]....

View 16 Replies

Passing Variable Value To Child Movieclip?

Oct 26, 2009

I have a movieclip that will load an external picture from a given path, it works fine if I hardcode the picture path. In the scene I added this moveclip at runtime, but now I have problem to pass in the a string path value to the movieclip so that in can load a correct picture.

View 2 Replies

ActionScript 3.0 :: Can't Access Variable From Within Movieclip.

Sep 14, 2010

On the first frame I have a string variable called "nextSection". When the user clicks on a menu item on the site then "nextSection" is populated with the name of that section. Later on in the fla I have a movieclip containing various sections for the site. The swf compiles without any problems.

I'm now attempting to make the file smaller and easier to update. Rather than have 8 different movieclips that load images, I thought I would just have the one. I changed the following lines in my fla
PHP Code:

// nested within 2 movie clips (sections.aboutUs)loadImage("aboutUs/mainImage.jpg");//nested within 2 movie clips (sections.outdoorAdvertising)loadImage("outdoorAdvertising/mainImage.jpg");// there are 8 of these in total.

[code]...

I'm now getting the error "1120: access of undefined property nextSection". The variable does not contain anything when the file compiles. Only when the user clicks on a menu item does the variable get filled (ie: if user clicks on the OutDoor Advertising button, the variable contains the string "outdoorAdvertising" which is also a folder in the site directory). I tried to populate it with the name of one of the sections on the first frame ( ie: nextSection:String="aboutUs"; ) just to see if it worked but still got the error.

View 8 Replies

ActionScript 2.0 :: Storing Variable To Use In Another Movieclip

Jan 5, 2011

This script from MC 1 loads an template from the library and then creates as many instances as the XML says.

It also creates a dynamic variable called ppp. This variable i want to store in each of the newly ceated instances and then use it in another movieclip to load the right path where i want to load another xml file in Flash....

This is what i want to accomplish:

xmlData.load("albums/album"+ppp+"/images.xml");

This code is in another movieclip (MC2) and gets loaded in frame 5 of MC1.

Another soltuions is if it is possible to read the value that is loaded in the dynamic textfield nummer_txt from the template:
Actionscript Code:

[Code].....

View 2 Replies

ActionScript 3.0 :: Reference A MovieClip Via Variable?

Nov 12, 2011

The scene is a number of movie clips, all already added to the stage (i.e. not dynamically) and when one is clicked, I need to call a property of that clip. [code]...

View 3 Replies

ActionScript 3.0 :: Use A Variable Value As A Reference To A MovieClip?

Oct 14, 2008

How do you use a variable value as a reference to aMovieClip?I'd like to do this:

A2.visible = false;
myVar = A2;
myVar.visible = true;

[code]......

View 1 Replies

ActionScript 3.0 :: Access Variable From Within A Movieclip?

Jan 17, 2009

i have variable a=0 and i want a movieclip that runs to change it to 2, what do i write in the movieclip code ? i tried parent.a=2 but it's error.

View 4 Replies

ActionScript 1/2 :: Variable For Each Movieclip/instance Name?

Aug 30, 2011

I make several movieclips on the stage so they have names zombie1 zombie2 zombie3 etc. and I was wondering how to I assign a single variable to each of them.. rather than having to create 3 variables. For instance, var zombieHealth would need to be different for each instance, is there an easy way or do I have to create loads of variables in a for loop?

View 1 Replies

ActionScript 3.0 :: Use A Movieclip Path From A Variable?

Oct 6, 2011

I have a variable that will change,

and i want to make it my movieclip path, example[code]...

View 7 Replies

How To Pass Variable From Inside MovieClip Into Another One

Sep 29, 2011

I am creating a quiz and I set one quiz block with questions into a movieclip. When the person answers the correct answer I want it to add to a counter and pass that value onto the next movieclip. So movieclip one is added to the stage it does something then adds a counter. Then moves to the next frame and movieclip2 is added to the stage. It does something and add to the same counter variable from movieclip1. And so on and so on until no more movieclips.

View 1 Replies

ActionScript 2.0 :: Asign Movieclip Name Into Variable

Feb 23, 2009

I need to hold movie clip name into a variable or array...I used to make movie clip on stage.

for(i=0;i<total;i++){
duplicateMovieClip("dots", newm[i], this.getNextHighestDepth());
dots1._x=xcor[0];

[Code]....

I am asigning names to moviclips from a XML file... this code working fine and creating 2 movieclips named dot1 and dot2. What I need use a array or variable which can hold this movieclips name. So I can use this code like this way...

newm[i]._x=xcor[i];
newm[i]._y=ycor[i];

View 0 Replies

ActionScript 2.0 :: Hold Variable In MovieClip?

Aug 13, 2009

I have a movie clip that I am turning into a button that when it is clicked it updates a text field with the string that is associated with the movie clip.

Do I have to create an Object on that movieClip and assign a var with the string?

so far I have

Code:
seat1MC.onRelease = function(){
this._alpha = 80;
textbox2.text = textbox2 + seat1MCtext;
}

This way the var seat1MCtext is just added to what ever was already in textbox2.

View 2 Replies







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