Variables based on _x or _y

  • genius
  • Newbie
  • Newbie
  • User avatar
  • Posts: 12
  • Loc: San Antonio, TX

Post 3+ Months Ago

When I click on a button I want Flash to check the location of a MC and take action based
on the MC's location.

Here's my code:

Code: [ Select ]
on(release)
{
    if (_root.mc_name._y=="0") 
    {
    _root.mc_name.gotoAndPlay("frame#");
    }
    else
    {
    loadMovie("movie.swf", "_root.mc_name")
    }
}
  1. on(release)
  2. {
  3.     if (_root.mc_name._y=="0") 
  4.     {
  5.     _root.mc_name.gotoAndPlay("frame#");
  6.     }
  7.     else
  8.     {
  9.     loadMovie("movie.swf", "_root.mc_name")
  10.     }
  11. }

I have uploaded my movie here:
http://www.sacritic.com/test.htm


If you click on any of the buttons (except main) the sides and center will move out of the way
to reveal the hidden content. I want flash to use the _y location to determine if the MC has already
slid out of the way, and if so, load some new content.

If you click on a button after the MC has slid away it just returns to the beginning of the MC and
reruns it.

Any help would be appreciated.

Thanks

Gene
  • 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

Well your general syntax is correct, but you shouldn't be comparing the _y value with a string value (putting the 0 in quotes).

Also you must make sure the _y position is on a whole value and not a decimal, it makes all the difference (Math.floor() can fix this).

But I don't believe that is your issue. It seems to me that this is all tweened animation inside a clip? I could be wrong since I don't know your setup, but you may be better off checking frame position with...
Code: [ Select ]
if (_root.mc_name._currentframe == framenumber){...}
  • genius
  • Newbie
  • Newbie
  • User avatar
  • Posts: 12
  • Loc: San Antonio, TX

Post 3+ Months Ago

Sweet, the _currentframe is exactly what I was looking for.
As far as the _y value goes, I tried comparing it with and without
qoutes but niether one worked. Doesn't matter now, your code fixed it.

Thanks

Gene

Post Information

  • Total Posts in this topic: 3 posts
  • Users browsing this forum: No registered users and 17 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.