ActionScript 2.0 :: Use Hittest And Eval?

Jul 24, 2005

when I use hittest and eval?

View 1 Replies


Similar Posts:


ActionScript 2.0 :: Using Eval For +/- Calculations ?

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

ActionScript 2.0 :: Any Way To Eval String Into Array?

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

ActionScript 2.0 :: Eval LoadMovieNum Is Not Working?

Aug 16, 2011

i'm new to flash programming. the code below is not working.[code]

View 3 Replies

ActionScript 2.0 :: Using Eval To Check Through All The Objects?

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

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

ActionScript 2.0 :: Eval New Array From String?

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

ActionScript 2.0 :: Eval And [] Differences (looping Fct)

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

ActionScript 2.0 :: Any Way To Eval A String Into Array

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

ActionScript 2.0 :: Create An "hitTest" Script Inside A Movieclip That Is Actually Part Of That HitTest Code?

Jan 15, 2009

i just would like to know how to create an "hitTest" script inside a movieclip that is actually part of that hitTest code?I mean... I have mc A, and mc B. and the current hitTest code im using (that is on the timeline) makes mc A, destroy mc B when collide with it... but there are many mc B on the stage (with the same instance name) so, when mc A collide with one mc B, it destroys ALL mc's B... but i want it to destroy only the mc B that he collides, not all the others... maybe an hitTest script inside a movieclip B would work (somethig like "if MC A hitTest ME = i die" (not all the others)).

View 1 Replies

Javascript :: Eval Throwing Error With Try / Catch

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

ActionScript 2.0 :: Using Set And Eval Functions Setting Variables?

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

ActionScript 2.0 :: Eval Usage On The Left Of Equals?

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

ActionScript 2.0 :: Eval() Versus [] Use In Nested Loops?

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

ActionScript 2.0 :: EVAL To Apply Text Variables?

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

ActionScript 2.0 :: Looping Non-array Variables With Eval()

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

ActionScript 2.0 :: Convert Eval() Flash 5 Code To It?

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

ActionScript 2.0 :: Eval Methods - Dynamic Object Name Creation

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

JavaScript :: How To Dynamically Call Function At Runtime Without Using Eval

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

ActionScript 1/2 :: Eval Or Array Push - Storing Variables And Displaying It?

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

Actionscript 3 :: Execute Arbitrary Code In Flash Like Javascript's Eval()?

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

Actionscript 3 :: Flash Eval() - Receive The Number And Then Play The Sound

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

ActionScript 3.0 :: Flash Dynamic Eval Of Path Using Array Syntax

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

ActionScript 3.0 :: Do Something After Hittest " Remove Hittest After First Collsion"?

Feb 8, 2010

i am controlling a tractor mc with right and left keyboard keys and let the user move the tractor till it reach a certain point where it touch a mc i want to go to a certain frame and stop the keyboard event listener and also the hit test listenerso finally the tractor is moved by user till it touches the mc then we will jump to a certain framethis certain frame will not have both of the tractor and the mcPHP Code:

import fl.transitions.Tween;
import fl.transitions.easing.*;
import flash.display.MovieClip;

[code].....

View 1 Replies

ActionScript 3.0 :: Eval - Making Dynamic Post Values To Post To A URL

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

ActionScript 2.0 :: Eval ( String) - String Is "myArray[1]" - Get Nothing

May 8, 2002

I have an array like this: myArray = ["a", "b"] I have a function with argument y like this: x = eval (y + "[0]") if I call the function with y="myArray" I am expecting "a", but get nothing.

View 3 Replies

HitTest On Multiple Mcs?

May 14, 2009

I have a movie clip called frog who moves along the screen, I want him to jump when he hits any other movie clips. I can make him do so with the code below, the problem is that if I write the same function for the other movie clips it doesnt work, it still works on the first one but none others. I have tried attaching an onCilpEvent on both the frog and on all the other movie cilps so no avail.
 
function hitBaby(){
if(_root.babyWord.hitTest(_root.frog)){
_root.frog.gotoAndPlay("frogB");}else{  _root.frog.gotoAndPlay("frogA");}

[code]....

View 3 Replies

ActionScript 2.0 :: Set Depth On A Hittest?

Feb 25, 2009

i have this drag and drop thing basically when i drop the item on top of its slot i want it to do a hittest to set the depth to a number assigned to it. so lets say I drag an item called Item to a spot called slot i want it to do like item on hit test to slot set depth(2) lets say.

View 1 Replies

ActionScript 3.0 :: Hittest Is Not Working

Apr 7, 2010

i'm trying to build this simple game for school: you've got a catapult which launches a "bullet" and you will have to aim it to hit a certain point. Now the whole catapult part and shooting the "bullet" works, but now it has to respond when it hits something, and that's where i'm stuck.

[Code]...

View 1 Replies

ActionScript 2.0 :: HitTest Is Not Working

Aug 12, 2010

I'm trying to make a hitTest between to movie clips (Let's call them J and T)[code]But nothing happens when the two movie clips collide.

View 5 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved