|
-
XRave
ActionScripting Error HELP!!!
A problem from a RPG game I'm designing -
Ok so if I have a MC called guy and a MC called shop, I can use Keyboard to navigate guy and this is what I am trying to do #
If guy is hit-testing shop, I want a dynamic Txtbox to say: - Press Space to Acess Shop - Better get your wallet first! -
And If I press SPACE while guy is hit-testing shop, I want to gotoAndStop to another location.
This is the AS i dreamed up:
Code:
onClipEvent (load) { if (this.hitTest(_root.guy)) { description = "Shop Keeper, Its best if you have some money on you though"; if (Key.isDown(Key.SPACE)) { _parent.gotoAndStop("eleswhere",1); } } }
So could anyone tell me what's wrong and how do i fix it?
When you actually know what "OMG I have so much homework!" means, you won't want to be me.
Xrave
-
Ok, firstly you need to have it on an
onClipEvent(enterFrame)
handler, the load handler only runs once when the movie runs.
Secondly, you need to use
Key.isDown(KEY.SPACE) //-- Capital 'KEY'
Hope that helps, i dont think there is anything else wrong with it..
Alex
-
XRave
Er it is on the onClipEvent handler.
the code thing didnt work out proper.
.. I'll try it maybe your right.
When you actually know what "OMG I have so much homework!" means, you won't want to be me.
Xrave
-
no, its on the onClipEvent !!**LOAD**!! // NOT the same as enterFrame.
Load will activate the script once, enterFrame will activate the code every frame.
so you should have
onClipEvent(enterFrame){...}
not
onClipEvent(load){...}
Alex
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|