A quick flash question

  • chazmonro
  • Newbie
  • Newbie
  • chazmonro
  • Posts: 8

Post 3+ Months Ago

Ok guys why doesn't this work?

x=random(14);
x=x+1;
theSlide = "mc_Slide"+x;
_level5._root.theSlide.mc._visible=false;

But this works

_level5._root.mc_Slide14.mc._visible=false;

Any ideas?

Thanks,
Chuck
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • lostinbeta
  • Guru
  • Guru
  • User avatar
  • Posts: 1402
  • Loc: Philadelphia, PA

Post 3+ Months Ago

Why are you using _level5?

And why are you adding 1 to x after the random?

You should be doing
Code: [ Select ]
x=random(14)+1;
theSlide = _root["mc_Slide"+x];
theSlide.mc._visible=false;
  1. x=random(14)+1;
  2. theSlide = _root["mc_Slide"+x];
  3. theSlide.mc._visible=false;
  • chazmonro
  • Newbie
  • Newbie
  • chazmonro
  • Posts: 8

Post 3+ Months Ago

Hey Lost! You are the man! My buddy and I were racking our brains yesterday trying to figure that one out.

This is the code that ended up working
Code: [ Select ]
x=random(14)+1;
    theSlide = _level5._root["mc_Slide"+x];
    theSlide.mc._visible=false;
  1. x=random(14)+1;
  2.     theSlide = _level5._root["mc_Slide"+x];
  3.     theSlide.mc._visible=false;


We're building a website that has an array of 15 externally loaded images that populate a grid (its a simple design element) Anyway, after the 15 images are loaded onto level 5 we wanted a new function to run every 5 seconds that would swap in new images randomly. This function was just a test to see if we could actually target the movies on level 5. I duplicated a mc and that is why I needed to add 1 to the 14 because the mc's are named 1 to 15 not 0 to 14.

Anyway, I'll give you a link to it, its nothing special, I've been working with flash for 5 years, but as you can see I'm not an expert at any rate, so thank you very much for the help. I did not design the site, so you can flame it all you like.

http://strengweb.strenghosting.com/

Thanks again for the help.
Chuck
  • lostinbeta
  • Guru
  • Guru
  • User avatar
  • Posts: 1402
  • Loc: Philadelphia, PA

Post 3+ Months Ago

Glad everything works.

I was just confused about the whole _level5._root syntax. Does it not work if you remove _root?

And I know why you were adding 1 to x, but I didn't understand why you were adding it seperately.

You've been working with Flash for 5 years? Wow. Almost 3 years here myself... I can't believe it...lol. There's still SO MUCH I need to learn... especially since I haven't even broken into AS2.0 yet... oye.

Nice effect you got going on there.

Post Information

  • Total Posts in this topic: 4 posts
  • Users browsing this forum: No registered users and 26 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.