ActionScript 2.0 :: Instance Name Not Eval'ing Correctly
Apr 28, 2003
I have a global map, when the user selects a continent it loads a seperat swf for that area. The continents grab variables from a database, and bring a bunch of variables into the movie.
One group is for the names of countries. It grabs the country name and it's 2 letter code. Then passes the country name to the local movieclip with that same instance name.
This works well for the most part. A couple countries don't load. Right now I'm looking at Asia. The country od Malaysia with it's code of "MY" produces errors half the time. Well most of the time.[code]...
View 1 Replies
Similar Posts:
Sep 14, 2011
I'm trying to work on my first flash game but I'm already having problems making my character move.I'm currently following this tutorial:However, when I try to test my game, I get an error saying:"Access of undefined property player_mc"In the scene, I have a square MovieClip called "player" and when you select it, in its properties I have given it the instance name "player_mc".However I still get the error. So I decided to change the object's name to "player_mc" as well but that still gives me the error. I don't understand why this isn't working.According to this, it's just to do with spell-checking... but yeah, I looked through my code and the objects and it's all "player_mc".
View 2 Replies
Jul 24, 2005
when I use hittest and eval?
View 1 Replies
Apr 29, 2008
Basically I want to eval() a string like _level0.mc._x-=dist; where the "-" or "+" is a variable.You can paste this straight in and it should work.. only the last part (where it's doing the eval) doesn't.
Code:
this.createEmptyMovieClip("mc",this.getNextHighestDepth());
_level0.mc._x=200;
_level0.mc.createTextField("txt",_level0.mc.getNextHighestDepth(),0,0,200,200);[code]......
View 2 Replies
Dec 9, 2010
I have a response coming in from a server that contains a ton of strings that I need to eval to have them replace arrays already set as globals. So program fetches response, evals string into an array, and then we do stuff with the array. I've played around with little tests and can't get it working.
ActionScript Code:
var superArray= new Array('3','4');
var testArray="superArray=['1','2']";
function testEval() {
eval(testArray);
trace(superArray);
[Code] .....
View 1 Replies
Aug 16, 2011
i'm new to flash programming. the code below is not working.[code]
View 3 Replies
Feb 25, 2003
I was reading another query on this board about NOT using eval, as it had become deprecated, for attaching a name to a new MC. I have been using eval to check through all the objects, and to add ones with a certain name to an array.
for (i in this) {if ((typeof (eval(i))) == "movieclip" && substring(i, 1, 5)== "names") {
would there be another method of doing this using dot notation? sorry if this question seems a little muddled. I am new to flash, some things in it make a lot of sense and others are still confusing me.
View 3 Replies
Jun 21, 2008
I am passing flash a variable in string format and it looks like this
var stringVar = "new Array(new Array(1,3,4),new Array())";
Now i need to make an array out of it. I tried this:
var stringArray = eval(stringVar);
but had no success.
View 4 Replies
Jul 25, 2008
I'm not really good at figuring out how to do some things in Actionscript and I'm confused about looping throught functions with thins like eval. Here's my code :
[Code]...
I'm trying to loop to dynamically create functions. I have 5 boutons and I don't want to duplicate 5 times the same code. This code works but I don't seem to be able to use the same eval trick on the variable "blnBtn05". Anyone knows why and how can I be make it work?
View 4 Replies
Dec 9, 2010
stuck on a bit of code, trying to transition a program over from JS to AS2 flashlite 3.1.So here's the deal, I have a response coming in from a server that contains a ton of strings that I need to eval to have them replace arrays already set as globals. so program fetches response, evals string into an array, and then we do stuff with the array.I've played around with little tests and can't get it working. This is a dumbed down version of what I need to happen.[code]
View 3 Replies
Mar 20, 2009
Does creating a new instance of an Object that uses an identical name to an older instance, delete the previous instance? Or should the original instance be deleted first? The code uses a ridiculous amount of XML vars. Isn't it less memory intensive to parse the XML and save the properties to an Object, and then delete the XML Object, rather than keep the XML Object around and reference it's child nodes directly? Is it better form to break up a huge XML file (>600lines/3200vars) into smaller chunks?
View 1 Replies
Nov 29, 2011
I have an air application, in which the user types javascript in a textarea, and it is eval'd in an mx:HTML component, but even with try/catch around the eval, and around the code in the eval, and an HTMLUncaughtScriptExceptionEvent handler, it still throws an error. htmlWindow is html.htmlLoader.window.
[Code]...
View 1 Replies
May 12, 2006
I'm having problems in setting three variables using a for loop and then passing these variables to my function. I think it's something to do with the set function I'm using, because my colorFadeTo function claims it's being passed an undefined variable.
Code:
for (var i=0; i<circles.length; i++) {
var current = circles[i];
[code].....
View 1 Replies
Apr 1, 2007
I'm sick of writing long scripts or being locked in certain cases to not being able to use dynamic features because I don't know how to use things like eval on the left side of the equalsHere's an example
Code:
base.mitem1y = mitem1._y
base.mitem2y = mitem2._y
[code]....
View 3 Replies
Jan 23, 2008
why code snippet #1 works, but code snippet #2 doesn't? i thought the array operator would work in this case...
CODE SNIPPET #1:
Code:
for (i=0;i<products.length;i++)
{
// XML data code
for (j=0;j<prodItems.length;j++)
[code]....
View 3 Replies
Jul 19, 2003
I have a clip containing 8 MCs, named id1, id2 etc, each of which contain a dynamic text field with the variable thisNo. I want to run a loop that inserts each digit from a randomly generated number into each of these MCsPatID is the random number, IDLength is it's character length.
for (i=1; i<(IDLength+1); i++) {
thisNo = PatID.substr(-i,1);
eval("id"+i).iconNo = thisNo;
[code].....
View 6 Replies
Sep 3, 2003
I want to do a for loop that grabs values from different variables. This function works nicely without the eval() statement (using the commented line below it) but not with it.
function saveData ()
{
saveUrl = "savedata.php?";
for (count=1; count<=numberOfVariables; count++)
[Code].....
View 14 Replies
Jul 27, 2010
I'm trying to update an old flash 5 site I made years ago so that I can put video clips in it. I opened the file is flash cs3 and compiled just to see if it would work as is before modifying. It's hanging on a bunch of code, all which have eval() in them. It's been a loooong time since I coded actionscript so while I know that the bracket syntax is what I should be using, after trying various ways of writing it I just can't figure it out. Can someone tell me how the following should be written in Actionscript 2.0 and I can extrapolate from there?[code]...
View 1 Replies
Mar 9, 2009
I'm having problems with my usual eval methods of creating objects to read off dynamic values programmatically using concatenation. I've found the set command doesn't seem to work with objects that are dynamic....
Code:
function createobject(item){
//create it and store something in it
set ("_root.item"+item.stored, "data storage test for item "+item);
}function checkobjects(){
for (i=1;i<5;i++){
checkit=eval("_root.item"+i);
trace("_root.item"+i+".stored="+checkit);
[Code] .....
Running this produces the output of...
Code:
_root.item1.stored=undefined
_root.item2.stored=undefined
_root.item3.stored=undefined
_root.item4.stored=undefined
How to do this - basically I'm trying to load data, then use that to create dynamic objects and values within it, then I'm trying to work with those values by again using loops to read off the dynamic values during runtime. Obviously if these were "fixed" variables, then it would be easy, problem is that its impossible to use the new Object() command with dynamic names!
Previously I've used this:
Code:
checkit=eval("_root.item"+i+".stored);
trace("value is "+checkit);
Is it my imagination, or was this stuff a lot easier to do in AS1?
View 2 Replies
Nov 11, 2011
I'm trying to build an API in JS that will perform some operations and then execute the callback that's registered in AS when it's done. Because it's an API, I am just providing a JS method signature for another developer to call in Flash. Thus, the callback name that's registered in the AS part of the code should be a parameter that's passed in to the JS API in order for JS to communicate back to Flash.
For example:
[AS3 code]
ExternalInterface.addCallback("flashCallbackName", processRequest);
ExternalInterface.call("namespace.jsFnToCall", flashCallbackName);
function processRequest(data:String):void {
//do stuff
[Code] .....
Because the definition of the function is in AS, I can't use the window [function name] approach. The only way I can think of is to build the callback in a string and then use the eval() to execute it.
View 2 Replies
Mar 9, 2011
I have a variable call php_variable that loads from the php. It echos all the necessary variables. I have 2 array, Tel_start and Tel_area. The messages.text is just a text field I use to test if things are loading properly.
[Code]...
It display the correct string. But when I use Tel_start[0] like above, I got undefined. So here, the actual quesetion, what's the proper way of storing those variables and displaying it?
View 9 Replies
Apr 1, 2010
Is there any way to execute arbitrary code in Flash, like javascript's eval()? I'd like to take some code as a string and execute it, if possible
View 2 Replies
Aug 13, 2011
I have 15 sounds in my fla; I imported them to the library and exported all sounds with the name s1, s2, s3, ... s15 I created a function that recieve the number and then play the sound. In AS2 I could use eval like eval("s" + n), but in AS3 I can't!
[Code]....
View 2 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 15, 2010
I am making dynamic post values to post to a URL.
[Code]...
Maybe I am doing this the hard way with eval, is there an easier way, such as passing an array of post variables?
View 3 Replies
Jun 17, 2010
I have a library object (SomethingMC) which extends a custom class (Something). Something, in turn, extends MovieClip.If adding SomethingMC to the stage within Flash CS3 IDE, is it possible for it's super class (Something) to assign an instance name from a class constant (Something.THE_CONSTANT)?
package
{
import flash.display.MovieClip;[code].....
The above does not work. It throws Error #2078: The name property of a Timeline-placed object cannot be modified. if the instance is assigned a name in the IDE, and it just doesn't work if no name is assigned in the IDE.
View 1 Replies
Dec 2, 2010
I have a BUNCH of bumpers of four types bounceUp, bounceDown, bounceLeft, bounceRight. during a collision which you hit determines the bounce so they always do the same thing so here's my question.....can i just name every bounceUp instance the same thing and then just add that one instance name to the list the collision detector checks?
i just dont wanna go through and name a hundred each of bounceUp s and bounceDown s individually as the potential for screaming increases proportionally.......
View 5 Replies
Apr 16, 2011
I placed a movie clip instance inside a button, and I want this movie clip to play when the button is released. I'm using this code on the frame containing the button:
function playMovie(event:MouseEvent)
{
this.theButton.theMC.gotoAndPlay(3);
[code].....
View 2 Replies
Jul 19, 2004
Does anyone know if it is possinle to scroll a graphic or a movie instance as well as a text instance in flash. I want to scroll text and images as well. Actually text with imges embedded in it.
View 3 Replies
Mar 14, 2006
I am wrapping my brain around OOP in AS2. I am making two posts on two different subjects. My question here is: when should I use local instance variables, and when should I attach new properties to the instance object? (Feel free to correct my terminology.) Let's say I have a class for a scrolling background, which scrolls when I mouse over its edge. I want to put these values somewhere:
1) How wide is the border in which a mouseOver makes it scroll? This is basically a semi-constant I set it up once and keep it the same, unless the user changes it in an options menu to make the border wider or narrower. Call this scrollBorderWidth.
2) How fast is the background scrolling now? I want to track this so I can smoothly change the scroll speed over several frames. This is often changed. Call this scrollSpeed.
It seems I have two ways I can store and access these values and darned if I know which is better practice. METHOD A: Make them local variables in the class, so the scrolling background instance has them as local vars. I set them up thusly:
[Code]....
View 4 Replies