ActionScript 2.0 :: Cannot Get Square Brackets To Target MovieClip
Jun 20, 2006
I'm stuck with trying to target a movieclip dynamically from a loop. I'm using the square brackket syntax but I can't figure out why it's not working. Here's what I'm trying to do:
Code:
this.t1.t1._alpha=20;
And here's how I'm trying to do it:
Code:
this["t"+1+".t"+1]._alpha= 20;
View 3 Replies
Similar Posts:
Jun 20, 2011
I'm trying to do that trick where you make a variable name with square brackets. I think I don't fully understand what I'm doing though...
Code:
var cursorDirection1:Point = pt.subtract(rootpos1);
var cursorDirection2:Point = pt.subtract(rootpos2);
var farShoulder:int = 1;//1 = left 2 = right
[Code]....
I'm trying to avoid having to do a conditional to choose between cursorDirection1 or cursorDirection2. My last line there isn't working, I'm not entirely sure why. Assuming farShoulder is 1, the code should be interpreted as
Code:
cursorDirection1.normalize(findNormVar(cursorDirection1));
but I'm getting errors about the input being undefined.
View 9 Replies
Aug 10, 2007
I'm reading a book on ActionScript and I'm in the section on controlling movie clips. I'm reading about the basic methods, and I'm starting to realize I still don't fully understand the significance of square brackets.[code]Obviously, this is the prototype form of the lineStyle() method. What I don't get is why "thickness" is the only parameter without square brackets. I know that square brackets are used for retrieving data from an array or object, but either my book doesn't cover why they're used like this in a method, or I just completely blanked it out.
View 2 Replies
Oct 13, 2010
I have some classes stored in a swc which I would like to instantiate using data pulled in by xml - using a string to reference the classname.So where I would normally use
ActionScript Code:
var tagline:Sprite = new Tagline1();
I would now like to do something like
ActionScript Code:
var tagname:String = "Tagline1"; // really the string comes from XML
var tagline:Sprite = new [tagname]();
I have a vague idea this is possible using square brackets, but I don't seem to be able to find out anything about it.
View 5 Replies
Oct 19, 2011
I am kinda new to as3 and I have seen [] the square brackets used when trying to access array index but I have also seen some people use it in other places. I was just wondering what its exact function was.
View 1 Replies
Dec 2, 2010
when creating a dynamic square with the api. 400 by 400. I am not sure why it wont draw the object
[Code]...
View 2 Replies
Jan 15, 2010
I have this game, and some levels have a moving square as the player, you move the square with your arrow keys.... I want to have an enemy square that chases the player square.... They only chased mario when you didn't look at them? Kinda like that...... but in this regards:
I only want the enemy square to chase the player square when the player square moves.... soo say the player square moves 5 pixels per movement (know how to do all that), I want the enemy square to move when the player square moves..... towards the player square at like 7 pixels per movement..... so eventually you won't be able to avoid the enemy square....
View 4 Replies
Dec 3, 2003
I am messing around to learn more about actionscript and I am trying to have a square movieclip resize itself so both sides are equal to 50 here is my code on the movieclip it does the resize and all but it keeps on going. I am not sure how to stop it.
[Code]....
View 6 Replies
Aug 30, 2010
qi have a movieclip which is added to the stage:
var profileholder:profileHolder=new profileHolder ;
inside of profileholder is another movieclip(infoBtn) that acts as a button.when the mouse is over profileholder i want to do something with infoBtn like:
//profOver is the over state of profileholder
function profOver(e:Event) {
e.target.infoBtn.alpha=1;
}
this doesn't work and brings up this error:ReferenceError: Error #1069: Property infoBtn not found on flash.display.Loader and there is no default value.
at main_fla::MainTimeline/profOver()
i also tried:
function profOver(e:Event) {
var item:profileHolder=e.target as profileHolder;
item.infoBtn.alpha=1;
}
and get this error:TypeError: Error #1009: Cannot access a property or method of a null object reference.
View 1 Replies
Jul 20, 2010
I have a movieclip that I am using greensocks transformManager with so the user can rotate, skew, and scale the clip. This works fine, but I am trying to add a crop tool. If the image is rotated, when I send the image to the crop tool it measures the height of the image by the bounds of the rotated image, not the actual height of the image if it were square (re: not rotated).
So, what I tried to do what, after sending it to the crop tool, rotate it back to 0 before getting the bounds using this code:
[Code]....
I don't understand the math here. Shouldn't it just rotate 3rads in the positive direction to equal it out? How would I return it to 0;
View 1 Replies
Oct 7, 2009
How would it be possible if draw a square, then put movieclip to move in it. It would move when rotate another movieclip..
View 0 Replies
May 21, 2010
I am trying to draw a triangle and square using a movieclip that follows the pen of a line.It works, both triangle and square draw together. But I keep getting a flicker of a movieclip in the top left corner.
View 0 Replies
Apr 21, 2004
hey guys, so, im going through colin moock's book, "the definitive guide", and im learning about global variables. so in his lesson he says to do this:
1. create a movieclip called square, with a square inside of it.
2. in the square mc's timeline, on frame 1, place this code :
_global.day = "tuesday";
3. go back to the main timeline and on frame one put this code:
trace(day); no according to moock, when i run the movie, it should output "tuesday", but all i keep getting is "undefined".i'm running mx 2004, so im wondering if that has anything to do with it.
View 8 Replies
May 17, 2011
How can I make an extrusion for a red square movieclip in flash or as3?
View 4 Replies
Jun 3, 2009
I have a circle_mc on the stage. Then I create randomly placed 20 squares (square_mc) on the stage. I can move my circle on that stage, and all I want is to check hitTestObject(or any *yet unknow for me* method that gives a result) if circle touches any of squares. Then I need to remove that touched movieClip (square) from the stage. hitTestObject checks if 2 specific objects are touched. My question is how to know which square is which, and then if it touches with circle_mc to remove it from the stage.
Code:
Select allif (circle_mc.hitTestObject( ?whatHere? ) ) {
?whatHere?.removeChild( ?whatHere? );
}
View 2 Replies
Oct 20, 2010
I have a square movieclip named squarepad. What I want is when I click on it to do [some stuff] according to where the square is clicked. It should be something like this:
if ([mouseclickedx] > 1) and ([mmouseclickedx] < 10) then
[do this]
end if
View 1 Replies
Aug 11, 2011
Inside movieClip container, there are colored buttons on layer1 and on layer2 there is movieClip square which covers the buttons. I want to use the color efffects and blending options of movieClip square to make layer 1 alpha. There are some blending options called alpha, difference, lighten and substract but Im not getting the right combinations. I want to make layer1 alpha only by using layer2.
View 1 Replies
Jan 8, 2010
I'm doing a project that makes a movieclip draggable in different droptarget movieclip. When it is dragged in the 1st target an animation is triggered and so as the rest of the droptargets.Here's my initial code that does'nt work:
btn1.buttonMode = true;
b1OrigX = btn1._x;b1OrigY = btn1._y;
//btn1btn1.onPress = function(){ startDrag(this);}//droptarget = box1btn1.onRelease = function(){ stopDrag(); //droptarge1t
[code]....
View 2 Replies
Jan 27, 2009
I have to send information to an external vendor using their existing parameters. However, they have included brackets [] in some of their variable names. As you might expect AS3 can't resolve the variable name. Does anyone know a way around this?
[Code]...
View 3 Replies
Jan 6, 2005
I was wondering why brackets are still given in actions that dont have parameters?
[code]...
They work without brackets too, dont they?Not that it makes a lot of difference, but I was just wondering
View 5 Replies
Jul 30, 2010
Its day 3 of learning AS3 for me. I cant seem to target a movieclip within a movieclip. I code with all my actions on the first frame of the root timeline and would like to continue this practice. But when I target the clip from the root my function wont run.
Here is my example:
Code:
wheel_mc.spinBackward_mc.buttonMode = true;
wheel_mc.spinForward_mc.addEventListener(MouseEvent.CLICK, spinForward);
function spinForward(event:MouseEvent):void {
[code]....
Basically it wont gotoAndPlay("fadeIn") and I'm not sure why. So my question so I can move on in my AS3 learning is how to I target a movieclip with another movieclip, or is there another more proper way to do what I'm trying to achieve.
View 2 Replies
Nov 20, 2010
I have a form created using Flash CS3 and I want to pass the following hidden value name:
optionprod[ ]
The only problem is when I publish the file I get and unexpected "]" error. How can I pass the value with the brackets?
View 1 Replies
Feb 13, 2009
Let's say I have a function in a class with two required parameters and two optional:
Code:
public class Person extends Sprite {
private var haveToWork:Boolean;
private var hoursOfSleep:Number;
private var gotANewVideoGame:Boolean;
private var gotAHotDate:Boolean;
[Code] .....
All of that setup for this question: on the second call of the areYouHappy function, how do I keep the gotANewVideoGame variable from having a false value assigned to it?
View 2 Replies
Jul 14, 2010
I have some buttons working great on my main timeline using this code on the actual timeline[code]...
So I know I need to make Revlon_mc into another movieclip (so I can do the actual animation inside this movie clip and move it easily around the main timeline) but I'm not what the code would be (something to do with parent perhaps??) and would I still keep the code on the main timeline or would it sit within the new moviclip just created?
View 3 Replies
Jan 21, 2012
I am trying to trace the name of the button that started the eventListener. But instead I keep getting
instance11 instead of the name of the movieClip which should be a number between 0-5
below is part of my actionscript.
import fl.transitions.Tween;
import fl.transitions.easing.*;
import fl.transitions.TweenEvent;
[Code]....
View 2 Replies
May 31, 2009
I have an SWF that has a var that is a string called fullpath. Now, if fullpath was "game.item1", How would I evaluate it as _level0.game.item1 in brackets [] rather than _level0.game.item1.Basically, how would I evaluate an item path from a string with brackets []? This is AS 2
View 5 Replies
Feb 22, 2010
I'm working on a flash chat and I'm having problems with Regular Expression.
In Javascript this runs ok:
[code]...
My regex pattern works for but it ignores any letters in brackets.
View 4 Replies
Feb 4, 2011
I have a text file that needs to be parsed correctly. The text file looks like this:
[header]
[header 2]
[ header3 ]
I can grab these headers by doing so
var expression:RegExp = /[ [a-z0-9 ]+ ]/igxm;
var items:Array = text.match(expression);
But I would also like to remove the white space from before and after the brackets, so the headers can align against the left edge. Also, for [ header3 ], I would like to remove the white space inside the brackets, before "h" and after "3". What would be the correct regex for something this?
View 2 Replies
Jun 13, 2009
Been trying to figure this out for a few but no luck. I want to just make a new node and add it to an XML structure. So I've tried things like :
Code:
var xmlNode:XMLNode = new XMLNode(1,newNodeName.text);
var xmlObj:Object = xmlNode as Object;
[code]......
View 2 Replies
Sep 23, 2009
I have a chunk of Code which Flash confirms is without errors, but when I either compile the program or click the AutoFormat Button, Flash puts a curly bracket at the end of it and then has the audacity to complain that there are "extra Characters found at the end of the programm."I have to have this running to go online on Sunday the very latest.[code]
View 3 Replies