ActionScript 2.0 :: Dynamic Pathnames, Dot Syntax?
May 10, 2006
I'm using Flash 8, and creating a dynamic XML driven menu.I can't for the life of me figure out the syntax to make a 2 dimensional path to a movieclip.I can reference a movieclip dynamically with: _root["main"+i].label.text but how can I reference a movieclip like this:
_root.main1.subBut1_1.label.text
Where "main1" AND "subBut1_1" are dynamically written.I've tried _root["main"+i]["subBut"+i+"_"+t] and _root["main"+i]["subBut"+i+"_"+t], no dice.
Code:
function loadXML(loaded) {
if (loaded) {[code].....
View 5 Replies
Similar Posts:
Jan 14, 2011
This works fine
ActionScript Code:
mc1.onRollOver=function(){mc1._alpha=50}
mc2.onRollOver=function(){mc2._alpha=50}
[code]......
View 7 Replies
Sep 18, 2009
what I'm trying to do is access the data of several movies clips, that are inside of several other movie clips: MC1.insideMC._visible=false (which works, but isn't dynamic) but dynamically with a FOR loop. I've tried: For(bullet=1; bullet<5; bullet++){ "MC"+bullet.insideMC1._visible=false (this does not work) } Does anyone know the dot notation or another way to do this?
View 13 Replies
Jan 6, 2010
I have some movie clips in the library I am loading but I can't figure out the right syntax to get the librabry item dynamicaly so I had to resort to a chain of "if" statements. I left off all the extra stuff like position and addChild etc just to make the code more clear.
for(var i:int=1; i>4; i++){
addChip(i)
} function addChip(id:number) {
if(id == 1){
this["chip"+i] = new twoXchip1()
} if(id == 2){
this["chip"+i] = new twoXchip2()
} if(id == 3){
this["chip"+i] = new twoXchip3()
}}
So what I want to do, is instead of having 3 "if" statements - to just use the "id" value I passed in to identify the right chip in the library to load. My real if chain is actually much longer than three and it's difficult to update ..I know there's a better way to do it...but every way I try throws errors!
View 5 Replies
Jan 12, 2012
How can I call the property of a dynamic child mc within a static parent mc? For example: a parent movie clip with instance name "parentMC" has four child movie clips with instance names "mc1", "mc2", "mc3", "mc4"
[Code]...
View 5 Replies
Jul 29, 2010
Having a hard time trying to resolve this issue, done a bit a of digging but can't find what i'm after. I'm pretty new to AS3 but know that Eval() has gone and been replaced with [] syntax. However, i'm trying to access a dynamic path to a clip and it seems that the array syntax will not allow more than one variable in a path.
[Code]...
View 2 Replies
Jul 14, 2011
using action script...
stop();btn001_btn.addEventListener(MouseEvent.CLICK,showimage1);function showimage1(event:MouseEvent):void { gotoAndPlay(10);}btn002_btn.addEventListener(MouseEvent.CLICK,showimage2);function showimage2(event:MouseEvent):void { gotoAndPlay(20);}
however movie is playing without stopping to "Listen" for a Mouse CLICK. Images placed at frame 10 and 20 should appear only when CLICK'd.
This code is straight out of Classroom in a Book CS4.
View 5 Replies
Sep 2, 2011
[Code]....
I want to create "numeroEnemigos" Enemigo objects but flash give me this error "1084: Syntax error: expecting identifier before leftbracket." in the "var ["enemigo"+n] ..." line what is the problem?
View 7 Replies
Apr 1, 2011
I have this code gameOver1.text = (count1.currentCount / 100).toString();but i want to add some text before i display the current count. for instance in gameOver1.text i want to say
View 4 Replies
Mar 15, 2009
I've just found this ActionScript and tried it out in my Flash MX file. However, when I preview the movie, it comes up with 2 errors - either for unexpected } or expected {.[code]...
View 2 Replies
Sep 1, 2010
Getting Syntax Error with XOR. My script is as follows[code]...
View 24 Replies
May 24, 2011
I have this XML structure:
<numb>
<variable>
<name>john</name>
[code].....
View 1 Replies
May 19, 2004
How can I replace this code to use dot syntax instead of slash?[code]...
View 1 Replies
Dec 15, 2005
I've got a for loop and some fuctions working, but can't get one line of code to work. The red line below is what I'm having a hard time with. I'm calling a function called "moveit". If I insert moveit(x1, y1); then it works, and my movieclip is moved to the x and y positions that I specified for item #1. Though I want it to work for 10 items (I only have coordinates for two here, and will add the rest later).
I've searched my ActionScript book and just can't figure out what the syntax should be for calling that function.
[Code]...
View 14 Replies
Jun 2, 2009
I'm pretty new to Flash and my first project is my own on-line portfolio. I found (what I think is a Flash 5) code on this board to create an infinite menu. I'm trying to tweak it so that it works in AS 2.0 for CS3 and I keep getting a syntax error. [code]...
View 2 Replies
Jul 7, 2009
I think this should be pretty simple but I have been trying to figure it out for ages. I have an xmllist that i am creating from an xml object so I just get a list of nodes, I want to target each of the page nodes using square bracket syntax like this:
xml..page[0];
but for some reason it isn't working. My xml file is loaded in and is written below.I need to be able to target the nodes numerically,
xml file:
<?xml version="1.0" encode="UTF-8"?>
<root>[code].....
View 2 Replies
Oct 15, 2009
explain in very very basic terms (or direct me to tutorial) what is happening in this syntax:
[code]...
this was part of and example on how to optimist code (posted in this forum awhile ago), specifically for replacing either:
[code]...
I understand how the brackets work, and that X is a variable (I presume a Number).
I assume that '^' == 'to the power of'.
I dont understand why they are using >> or 31 at all.
View 2 Replies
Jun 8, 2004
This animation I'm working on has a dozen pairs of movie clips (with only two library items, one for each type in the pair) with instance names of the form "x" and "xgoal" (this is a drag and drop thing).When I'm writing AS for the "x" clip, how can I refer to its "xgoal" generally? I tried something like:goalName = this._name + "goal";And then using the goalName variable in my dot syntax (retrieving the _x coordinate for the goal clip):this.xgoal = _root.goalName._x;But, of course, that did not work. How can I get around this?
View 1 Replies
May 19, 2004
How can I replace this code to use dot syntax instead of slash?
Code:
square.origX = _x;
square.origY = _y;
[code].....
View 1 Replies
Sep 15, 2009
I have an array like this:
Code:
var myData = new Array();
myData["name"] = "John";
myData["Age"] = 35;
What is the syntax to loop through and get the key and value? I have tried for each and for in but they just give me the value of "John" or "35", how can I get the key e.g. "Name" and "Age"?
View 2 Replies
Oct 27, 2010
i'm trying to make a simple flash movie in cs4. scene 1 > click a button > gotoandplay scene 3 thats all.
[Code]...
View 1 Replies
Sep 20, 2009
When I am trying to Parse the following XML using this code I am not getting any result..However if the xml file is truncated to have the <organizations> as the root node. I guess the problem is with the namespace, however not certain how to go about fixing it.been trying to resolve this for 3 hours now...
AS3.0 Code
var xmlManifest:XML = new XML();xmlManifest.ignoreWhitespace=true;var strManifestPath:String = new String("imsmanifest.xml");var urlrManifestURL:URLRequest = new
[code]....
View 6 Replies
Dec 5, 2009
I have a variable of type string which has been populated in Frame2( from an Input Text Field) with the name as g_Name.In Frame-4 I am performing a concatenation as mentioned below:var displayResult: [code].....
The problem is that it gives s Syntax Error for the second line.....
View 2 Replies
Jun 9, 2010
Is there a file or some code I could make in order to add an extra color or two for syntax highlighting? Like having a certain color for function names and a different one for numbers etc.?
View 1 Replies
Dec 1, 2010
My son is doing a self-study course and is currently haviong a problem with the syntax of a condtional statement in Actionscript 2The folllowing code,
if (colour="red") {gotoAndPlay("BadEnd_red")}
else if (colour="blue") { gotoAndPlay("BadEnd_blue")}
else //colour ="green" { gotoAndPlay("BadEnd_green")}
[code]....
View 3 Replies
Mar 24, 2009
I am looking for examples on typing the criteria for if /then statements, for loops, etc. Things such as the way to type "or" (|) and the way to say "not equal to", etc.
View 3 Replies
Aug 11, 2011
I have put all button inside movieClip called "container" and I have added "container." inside for loop and now I am getting errors.
for (i=8; i<15; i++){
container.this["button" + btns[i].name.replace("btn","")].mouseEnabled = false;
}
View 7 Replies
Apr 2, 2012
I'm getting this errormessege whole the time and I've tried for days now to fix it. ATM I'm programming an android application using flash cs5.5 and AS3.The Error message Line1 Infobtn_15 :1086 Syntax error: Expecting semicolon before rightparen.
Multitouch.inputMode = MultitouchInputMode.TOUCH_POINT.*;
Infobtn.addEventListener(TouchEvent.TOUCH_TAP, fl_TapHandler_15);
function fl_TapHandler_15(event:TouchEvent);
[code].....
View 7 Replies
Nov 22, 2009
I'm porting an existing java library to actionscript and since they are both realy similar, 95% of the work is simply flipping variable and function definition around.
public int foo(int bar) {}
//converts to
public function foo(bar:int):int {}
Is there a tool to automate the transition between java syntax and actionscript? I'm not looking to compile java to swf, just transform the source code to be (often nonworking) actionscript.
View 1 Replies
Jun 24, 2010
The braces shown below after ...ret):String are incorrectly being highlighted as red I'm using the following syntax definition file for actionscript: [URL] 2 Questions: Does anyone happen to know off-hand what causes this weird matching? Is there anyway of identifying the current syntax matching group under the cursor?
View 1 Replies