TeamPhotoshop
Reviews, updates and in depth guides to your favourite mobile games - AppGamer.com
Forum Home Latest Posts Search Help Subscribe

actionscript syntax

Page: 1 Reply
Jul 30th 2002#61717 Report
Member since: Dec 24th 2001
Posts: 222
i dunno much at all about actionscript but im trying to use it based on my javascript knowledge which is also limited. but anyways im trying to define some variables in mx and it tells me that i need to have them in on/onClipEvent handlers can anyone explain this to me?
and also i am trying to make it so an image follows my mouse horizontally (a good example is pankpages.com the navigation bar) so i was also wondering how you define the x value of an object and the mouse becuase i need to define one variable as an objects x value and another variable as the mouses x value
here is my script it doesnt work but maybe you can see what im trying to do
onClipEvent (enterFrame) {
var buttonx = _root.button1_x;
var mousex = _xmouse;
buttonx = mousex;
}
also i put the variables in the onclipevent before pasting it in here the message about needing to put them in onclipeven handlers was generated when my variables where defined on top of my onclipeven statement
Reply with Quote Reply
Jul 30th 2002#61752 Report
Member since: Mar 16th 2001
Posts: 2421
for starters it should be _root.button1._x

you forgot the .

Next why not just use an instance name to reffer to instead of your variable. I used a variable for mine but only to trigger an active state when the mouse is over the buttons. To simply have a button follow your mouse just use the instance name of your clip.

_root.clip._x = _root._xmouse;
Reply with Quote Reply
Jul 30th 2002#61886 Report
Member since: Dec 24th 2001
Posts: 222
thnx that should help alot
Reply with Quote Reply
Jul 30th 2002#61888 Report
Member since: Dec 24th 2001
Posts: 222
ok well now when the movie starts the movie that i want to follow the mouse starts there but how do i get it to move with the mouse?... sliding?
Reply with Quote Reply
Jul 30th 2002#61909 Report
Member since: Mar 18th 2001
Posts: 1604
well, if this is on frame 1 you need to be repeating the action so that it keeps checking for the position. try adding a "goto and play 1" action on frame 2.

chris
Reply with Quote Reply
Jul 30th 2002#61923 Report
Member since: Dec 24th 2001
Posts: 222
ok i got it to work but its really jerky if you move the mouse fast at all does anyone know how to make it smooth and look like its sliding?
Reply with Quote Reply
Page: 1 Back to top
Please login or register above to post in this forum