ActionScript 2.0 :: Bracket Syntax Looping Through A Variable?
Oct 25, 2007
I'm trying to express this syntax:
Code:
container0.picture._alpha = 0;
by looping through a variable named "p", like this:
Code:
["container"+p]picture._alpha = 0;
But I get no result (and no error message).
View 8 Replies
Similar Posts:
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
Mar 12, 2007
I have taken a bottle of Excedrin due to the headache I've developed from this problem I am having. I have some variables:
[AS]
var snd1:Sound = new Sound(this);
var snd2:Sound = new Sound(this);
[code].....
View 1 Replies
Jun 10, 2007
the following script brings me a problem:
w = this["ha", "hb", "hc", "hd" ];
w.onPress = function() {
myClip._visible = true;
}
How to assign to variable "w" values from the square bracket that are separated by comas to be assigned either one of them and not only the last value "hd". In this case whichever value is pressed makes myClip visibility true.
View 1 Replies
Dec 21, 2007
I'm trying to do something like this:
[Code]....
whats the correct syntax for declaring a variable thats name changes according to a different variable.
View 2 Replies
Oct 14, 2011
I'm trying to build a little question/answer program in flash using XML data as the source of information.I'm trying to build it in such a way that I only have to alter the XML, not the .as files.So, for example, I have
ActionScript Code:
ui.question_txt.text = xmlData.question1.question;
ui.optionA_txt.text = xmlData.question1.optionA;
[code]....
View 1 Replies
Mar 25, 2007
Whats the correct syntax for declaring a variable within a loop? Something like this:[code]
View 1 Replies
Jul 18, 2011
Alright here's my code :
[Code]...
After I run it gives me these two errors : Scene 1, Layer 'actions', Frame 1, Line 25 1084: Syntax error: expecting rightparen before colon. Scene 1, Layer 'actions', Frame 1, Line 27 1084: Syntax error: expecting rightparen before colon. Also in the output tab I get these errors : ReferenceError: Error #1065: Variable TLFTextField is not defined. ReferenceError: Error #1065: Variable TCMText is not defined. I've been trying to figure this out for about 30 minutes but wasn't able to.
View 3 Replies
Apr 14, 2011
I'm sure it's possible I'm just writing it wrong. Can anybody clue me in the correct way of writing it? I get compiler errors this way...
ActionScript Code:
for(b=0; b<=15; b++)
{
var ["ping" + b]:Boolean = false;
}
View 1 Replies
Sep 18, 2008
So I'm trying to clean up some banners I've worked on to put in my portfolio online, and the banner itself sits inside a "shell", so when called for, it loads into an empty mc. This is actually the method I prefer instead of loading it into levels. That's the setup, here's the problem.The banner itself has some repetitive action set up through a variable that if a certain action happens 3x, then move on to the next sequence and play out the rest of the timeline, otherwise go back and do the action until it occurs said 3x.
That part works fine. What happens at the end is that the variable hasn't "cleared", so once it hits the final frame, without doing anything or clicking on the "replay" button, it goes back to the first frame, and as a matter of fact, the action starts playing automatically instead of when the user clicks the "go" button.On an odd occurrence, when this has occurred within the shell of my portfolio link, it causes everything in the shell to "act screwy", playing everything at a faster frame rate, (that may be unrelated), but also making the main flash movie shell start from the very beginning.Like I said, I worked on this project, though I didn't do all the coding, so the part with the variable and how it affects the rest of the playback I can't control, nor know the first thing of how to fix it, (though I've tried).
View 2 Replies
Jan 15, 2011
Flash keeps looping which is causing certain variables to add values constantly. E.g.
if (userWord.text == word){
score = score + 1;
trace(score);
}
That will constantly add one to "score" when a certain word is typed into a text box. How do I add one to "score" without stopping the application or playing it once?
View 1 Replies
Aug 2, 2009
I would like to create a collection of movieclips in the main timeline, but would like to declare them in a loop instead one by one, something like this:
Code:
for (var zz=1;zz<=10;zz++)
var ["mc"+zz]:MovieClip = new MovieClip();
Instead:[code].....
I know that my sample doesnt work,
View 3 Replies
Jun 16, 2010
In the new Flash CS5 Actionscript editor, there's a bug with the auto close bracket. If I have an existing pair of brackets, when I hit the Return key in the same line as the opening bracket, the editor automatically inserts a closing bracket even when it is not needed. However if I press Return on the line after the bracket, it will not close the bracket. I don't seem to experience this in Flash Builder. One possible way is to disable the auto close bracket option but I find the auto close bracket is useful despite the slight annoyance mentioned above. I expect the editor would be able to detect if there's already a closing bracket and not insert a new one.
View 1 Replies
Apr 12, 2011
I've seen the embed tag used before the class definition, but I just saw that Keith is using these..
[Event(name="select", type="flash.events.Event")]
[Event(name="close", type="flash.events.Event")]
[Event(name="resize", type="flash.events.Event")]
[code].....
View 1 Replies
Oct 10, 2009
Is there an extension or mod available to allow Flash CS3 have bracket highlighting? I just think it would be very useful and save split seconds of confusion.
View 1 Replies
Apr 19, 2004
how one would get "<" and ">" to work if you use external say... .txt file for a textfield...
So say I put in my textfile
textfield= The cookies were great ---> and so was the milk<br><br>Yes I love cookies.
The <br> is html, but the ---> is not, yet it won't show...
Same goes for other characters, such as "&", ", '
View 1 Replies
Mar 29, 2010
I have to take a number and figure out which "tier" it falls into.For example, let's say I have a table that has three tiers "economy" "typical" "deluxe". From 0-12 is economy, 13-20 is typical, 21-30 is deluxe. My actual table has many more levels, but this is the concept.
What's the fastest and easiest way to do that? I was going to use a switch statement starting with the highest, but it doesn't look like that can be done
View 7 Replies
Apr 25, 2010
This is a snippet of my code which is giving me
1086: Syntax error: expecting semicolon before leftbracket.
What I'm trying to do is create a an array from the amount of "players" and then for each player in the array, add another array into each level of the array that has 3 levels which are all set to '0'. When I remove: var scoreArray[i]:Array = [0, 0, 0]; the error stops.
ActionScript Code:
public var players;
public var playerScoreArray:Array;
public function gameSetup() {
var playerScoreArray = new Array(players);
for (var i = 0; i < players; i++) {
var scoreArray[i]:Array = [0, 0, 0];
playerScoreArray[i] = scoreArray[i];
}}
View 1 Replies
Mar 16, 2010
I have the following MXML:
<mx:Script>
var someBoolean:Boolean = determineSomeCondition();
</mx:Script>
[code]......
View 1 Replies
Aug 22, 2005
can't figure out why the dynamic text boxes in my dynamic clip arent picking up the variable when I loop through this recordset!the trace (you'll see here right after I try two ways to assign the variable) traces the correct info back..
[code]...
View 1 Replies
Nov 29, 2011
I have a class Inhabitant with a property skin which is of type DisplayObject.
Within Inhabitant I need to access the x and y properties of skin using this method:
this["someProperty"];
Rather than:
this.someProperty;
This is fine with properties defined within Inhabitant but I'm not sure how I could do this for a property of skin. This obviously doesn't work but it might give you an idea of what I'm trying to do:
this["skin.x"];
The reason behind requiring this notation is that I have a function which I can parse a String though that will represent a property:
public function addTokenable(property:String):void
{
if(!isTokenable(property))
_tokenables[property] = true;
}
And then a related getter that will return a representation of this instance of Inhabitant as a String:
public function get token():String
{
_token = "class:" + getQualifiedClassName(this).split("::").join(".");
[Code]....
View 1 Replies
Feb 2, 2010
The issue I am running across is this: I encoded and embedded a movie clip to act as the background. There are other animations that can and will loop, as the movie resets itself. But there are some elements that I only want to run once and not repeat once the embedded movie loops (link introductions, where objects fly in and transition into the button). How can I set the one time animations to fire just once, while keeping the embedded animation on a loop?
View 1 Replies
Feb 2, 2010
I am fairly new to Flash and I am constructing a website. The issue I am running across is this: I encoded and embedded a movie clip to act as the background. There are other animations that can and will loop, as the movie resets itself. But there are some elements that I only want to run once and not repeat once the embedded movie loops (link introductions, where objects fly in and transition into the button). How can I set the one time animations to fire just once, while keeping the embedded animation on a loop?
View 1 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