ActionScript 3.0 :: Change Variable Value Dynamically?
Apr 13, 2011[code]....
need a way to change from tile0 to tile1 through variable [code]....
[code]....
need a way to change from tile0 to tile1 through variable [code]....
how can i change variable name dynamically
ActionScript Code:
i=2
vari + "i" = 7 //these don't work
//i need to trace these code
trace(vari2)
i allways get error. i've tried the bracket none worked for me like these quotation
how do i change this variable dynamically?
[URL]
how do i change this variable dynamically?[code]
View 6 RepliesI have an overlay that I pull up in response to a button click. This overlay is dynamically populated by a TextField, a MovieClip, and a Bitmap. I used to add them to the overlay with addChild() and induce a index out of bounds error to make them go away (I was in a hurry and I don't think I'm using removeChild() right). Well, I decided to do it better and dynamically change the object inside the holding variable. However... the Bitmap is gone. It won't appear. The overlay puller function takes a data-holding class I made and the picture is a BitmapData object.
I can't use the line new Bitmap(picture) because it doesn't work; that makes nothing appear. So, I guess my question is can I store a line of text in a variable and then use that variable as code? Like... Could I have something like this and get an image as an output? I imagine it could be done with XML, but is there another way? I tried storing the constructor in a variable and calling it with object.constructor, but I don't know if I was using it right and it didn't work.
[Code]...
I have an HTML button that I need to dynamically assign to an AS3 variable when clicked (in order to load an .mp3). I am using externalInterface.call to collect javascript variables - I am just unsure how to change these dynamically when a button is clicked.
View 2 RepliesIm really new to as3, and im just trying out some stuff, but i cant get a shape to refresh and change when i change its variable using a text field.If i change the text fields text before i test it, it works, but while its running it doesnt change it again.Btw, trying to change the stroke size.[code]i just want is so that when i change the strokeSize_txt text box, it will change the stroke for the shape.
View 2 RepliesI have 14 buttons, and each one declares a variable; example:
[code]...
On the next frame I have another 14 buttons, and on Release I want to create a new variable with the content of _root.competencia; example:
[code]...
Instead Flash tells me this: Left side of assignment operator must be variable or property.Its what Im trying to do possible? Hope somebody can help me, has been 2 days, and I cant understand what is going on, I have tried a lot of ways without positive results, I know I have a long way to go to learn actionscript, Im to new in this!
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?).
I'm trying to achieve something i thought would be extremely easy, but i can't get it to work!
[Code]...
I'm creating a board game which has 3 variables, p1Move, p2Move and activePlayer.
p1Move and p2Move store the p1 and p2 location on a game board. activePlayer stored who's turn it is at the moment.
I am loading a value in from a text file which changes the value of move. This all works fine when i designate a player directly:
ActionScript Code:
p1Move = [insert variable name],
but i want to designate dynamically based on who's turn it is.
Something like this:
ActionScript Code:
_root["p"+activePlayer+"Move"] = Number(this.varAmount);
so that flash changes the value of p1Move (or p2Move depending on who's turn it is) to varAmount. varAmount is the variable being read from the textfile.
Hopefully that all makes sense. Basically i want flash to change the variable associated with the active player only.
Is it possible to add dynamically an button or graphic symbol into some area ?Let's say i have two buttons, and in particular case i would like to display first button in that area and another time i would like to replace that button with second or another graphic.
View 2 RepliesHow do I go about changing my movie height on a certain frame on the timeline?
View 10 Replieshow to change the 3D centerpoint dynamically? In the flash IDE you can use the 3D rotation tool and easallydrag the 3D centerpoint. You can see the new position in the transform panel.I read a lot of forums and website.. and dit some coding, but with no result.I tried to do it this way:
var pp1:PerspectiveProjection = new PerspectiveProjection();pp1.fieldOfView=35;pp1.projectionCenter = new Point(-mybitmap.width/2, -mybitmap.width/2);mybitmap.transform.perspectiveProjection = pp1;
[code].....
I've got an Adobe Captivate file which is pulling through an SWF which I have created. I am not sure exactly how the CP file is importing this SWF but it is.I'd like to ensure that this SWF is on the uppermost layer when the file is published as at the moment it is placed further down the order - which leaves it obscured by other elements on screen. Is there any AS3 code like onEnterFrame or something like that in AS3 which would lift it to the highest depth?
View 3 Replieshow to dynamically change image id value.ex:
View 1 RepliesI need to use actionscript to change the color of a movieclip..
Heres my setup: need to change the color of head.stripes using a palette of colors. Whats the easiest way to do this?
What i am trying to attempt is dynamically changing a string/URL, for example if i have....
www.example.com/VIDEO/video1.flv
and then when i have captured this url (above) using the standard (mc._url) i then want to change this output like so..
www.example.com/NEWVIDEO/video1.flv
So I basically want to change a directory name. I know this is possible but im not quite sure how to pull it off!
I'm involved in a project that is pushing the limits of my AS3. Right now I am trying to use the throwSlider to dynamically change a circle MovieClip so that the slider starts at the left and when dragged to the right it increases the size of the circle. When dragged back it decreases. I am getting some interactivity but nothing great or smooth. I know I have to connect the code to the x boundaries but I am not sure how to go about it. The circle would give the user some notion of size the real change would be lineStyle(). My goal is to use this slider to increase the line thickness in a simple drawing app I am making for my students.
View 3 RepliesIs there a way to change an instance name dynamically?
View 2 RepliesI have a swf file that displays data from an external text file, alongside a bunch of buttons that link to html pages. What i would like to achieve is to somehow use the external text file to alter the URLs of the buttons.
The swf i am building is getting used as a 'what's new' section, so it will be updated almost weekly, hence it reading the external text file (so i can update it without using the fla). And because the whats new section changes alot, so too does the button links. Hence, the buttons need to be updated aswell, and ideally, that can be done from the external text file.
Why don't i just use the dynamic text to <a href> to the new page you ask? because that would be sucky.Besides, i think that something like this could open more opportunities to the way we (well at least I) construct our fla's.
i have a swf file that displays data from an external text file, alongside a bunch of buttons that link to html pages. What i would like to achieve is to somehow use the external text file to alter the URLs of the buttons.
The swf i am building is getting used as a 'what's new' section, so it will be updated almost weekly, hence it reading the external text file (so i can update it without using the fla). And because the whats new section changes alot, so too does the button links. Hence, the buttons need to be updated aswell, and ideally, that can be done from the external text file.
Why don't i just use the dynamic text to <a href> to the new page you ask? because that would be sucky. Besides, i think that something like this could open more opportunities to the way we (well at least I) construct our fla's.
Hope the Kirupa Krew can help, if not then have a great day anyways.
Adios
I�m making a full Flash site, and it would be bilingual. I m making the text parts with external xml files. And I just want that only the text change when the site user changes the language.
I�ve found a great example here [URL], but it appears that only works great in one single SWF file.
What I want is that this function works in the whole site; at any time de site user could change the language for all the text contents.
I �ve the site with this organization:
1- there�s a main.swf with the menu about/services/etc�etc� and it �calls� about.swf, services.swf�. ;
2- the services.swf file contain a sub-menu serviceA, serviceB, serviceC� and serviceA calls serviceAdescription.xml, and so on�
And I want that the language switcher on the main.swf works for the various xml�s that are in different swf�s.
How can I do that?
Can I change the PhilFlash method to make it works to the all site? How?
Theres any tutorial that teaches something similar? Or any Flash component? Where?
How to add a child to the stage dynamically? I can get a child to add to the stage but not using dynamic variables. Is it possible?
Example:
var firstRoundWinner:String = "Redsquare";
var mc:MovieClip = new firstRoundWinner();
// want it to say = new RedsquareaddChild(mc);
With Redsquare as one of my movieclips and the linkage is working. I can add it if I hard code it. But I want to load the variable dynamically through xml.
My requirement is not to dynamically embed fonts in Flex, but to dynamically embed variable in Flex.[code]...
View 3 RepliesSo, if I need to give a custom variable name to an object how would I do that?
For instance, if I have a gameID that is 12345 and its rating is 3 I want to save a variable called gameRatings_12345 thats value is 3 in my shared local object.
//share object
protected var mySavedData:SharedObject = SharedObject.getLocal("mySavedData");
I have the game id in a string
var gameID:String = "12345";
Then when I try to assign the value like this...
mySavedData.data.gameRatings_gameID = 3
I think it's literally reading it as "mySavedData.data.gameRatings_gameID" instead of "mySavedData.data.gameRatings_12345"
How can I give the variable a custom name?
Is there a way to create a new XML object dynamically? i need to do this because i don't know how many xmls there will be.[code]
View 12 RepliesHow can I change the color of a movieclip dynamically and still keep it's filters? For example:
I have a movieclip on stage with a bevel filter on it. I then want the movieclip to change from blue to red when it's moused over and vise versa when moused out.
The color values I have are hexidecimal: 0xff0000, 0x0000ff
How can I do this? I tried colortransform but when I use that it changes color but removes filters.
how to change the button image dynamically through AS3?
View 1 RepliesHow do I go about changing my movie height on a certain frame on the timeline?
View 3 Replies