all groups > flash actionscript > january 2004 >
You're in the

flash actionscript

group:

Undefined Variable


Undefined Variable gnevius
1/13/2004 7:49:09 PM
flash actionscript: Hello friends!
I am getting the following output in my Flash movie. You can see my Actionscript below. Can anyone please tell me what I am doing wrong?
Thank you very much for your time and consideration!
Kind regards,
Greg

Debugging Output:

Level #0:
Variable _level0.$version = "WIN 6,0,21,0"
Variable _level0.randomImage = [function 'randomImage']
Variable _level0.fadeImages = undefined
Movie Clip: Target="_level0.imageHolder"


Frame 1 of Timeline:

stop();
fadeImages = setInterval("randomImage",3000);

function randomImage(){
whichOne = Math.floor(Math.random()()*10 + .5);
}
if(whichOne==1){
attachMovie(image1,imageHolder);
}
if(whichOne==2){
attachMovie(image2,imageHolder);
}

Re: Undefined Variable stwingy
1/13/2004 8:38:22 PM
I`m not entirely sure as to what you are trying to do but try this

stop();
fadeImages = setInterval(randomImage, 3000);
function randomImage() {
whichOne = Math.floor(Math.random()*2+1);
if (whichOne == 1) {
attachMovie(image1, imageHolder);
} else if (whichOne == 2) {
attachMovie(image2, imageHolder);
}
}

//I`ve changed the way you get whichone to give a value of 1 or 2.

Certified but not by Macromedia!
Re: Undefined Variable gnevius
1/13/2004 8:44:46 PM
stwingy,
Thanks for your reply, I appreciate it! I am trying to have Flash randomly load one image (out of five) and transition between the two with a keyframed fade.
With your code, it still did not work, so I must be doing something wrong with my movie clips. I've been at this for too long and just getting frustrated.
Thanks once again!!!
Kind regards,
Greg

Re: Undefined Variable stwingy
1/13/2004 9:16:13 PM
the attachMovie code is not right anyway, are you trying to attach a mc or load a swf.

Certified but not by Macromedia!
Re: Undefined Variable stwingy
1/13/2004 9:21:20 PM
The code for attachmovie is wrong anyway, have a look at this,it might help. You may want to add some fadein,fadeout functions to it.

Certified but not by Macromedia!
Re: Undefined Variable gnevius
1/13/2004 9:21:22 PM
I am trying to load a movie clip that is created from a bitmap image.
If you would be willing to take a look at the file, I can post it. If not, I certainly understand. I just appreciate you helping me out in any way. Thank you so much!
Greg

Re: Undefined Variable stwingy
1/13/2004 9:22:59 PM
oops

http://webforums.macromedia.com/attachments/loaderp.zip

Certified but not by Macromedia!
AddThis Social Bookmark Button