Do you enjoy using these boards? If so, please contribute today.
Your support keeps 420chan alive. Really.
June Server Costs
420chan JSON API Now Available - Documentation - Discussion Thread
Build apps and browsing enhancements!
Leave these fields empty (spam trap):
Name
You can leave this blank to post anonymously, or you can create a Tripcode by using the format Name#Password
Comment
[*]Italic Text[/*]
[**]Bold Text[/**]
[~]Taimapedia Article[/~]
[%]Spoiler Text[/%]
>Highlight/Quote Text
[pre]Preformatted & Monospace text[/pre]
1. Numbered lists become ordered lists
* Bulleted lists become unordered lists
File

Sandwich


flash actionscript 2.0 problem by Hedda Blatherforth - Tue, 05 Jun 2012 05:38:31 EST ID:G+G19LLV No.18330 Ignore Report Quick Reply
muis doolhof begin.swf -(5724 B, 0x0) Thumbnail displayed, click image for full size.
Hey, I'm not sure if this is the right place to ask for programming problems but I'll give it a shot anyway.

I'm making a game in which a collision with an obstacle will bring me to a certain frame and stop.
this here is the code that I'm using, for now, it only turns my MovieClip to alpha 20%, and it is working. But what I want is to go to frame 1 and stop instead

onClipEvent (load) { moveSpeed = 3; } onClipEvent (enterFrame)
{ if (Key.isDown(Key.RIGHT)) { this._x += moveSpeed; } else if (Key.isDown(Key.LEFT))
{ this._x -= moveSpeed; } if (Key.isDown(Key.DOWN)) { this._y += moveSpeed; }
else if (Key.isDown(Key.UP)) { this._y -= moveSpeed; }
if (_root.obstacle.hitTest(this._x, this._y, true)) { this._alpha = 20; } }

simply replacing { this._alpha = 20; } by { GoToAndStop(1) } does not work

hope someone can help :)
the game so far is added
>>
George Beckledatch - Tue, 05 Jun 2012 07:27:03 EST ID:iRoOSfeT No.18331 Ignore Report Quick Reply
>simply replacing { this._alpha = 20; } by { GoToAndStop(1) } does not work

add "_root." i.e. "_root.gotoAndStop(1)"
>>
Nicholas Wellerwill - Thu, 07 Jun 2012 17:49:27 EST ID:mbgL4xKu No.18336 Ignore Report Quick Reply
>>18331

alright, thanks
ill give that a shot
>>
John Ceckleman - Sun, 10 Jun 2012 13:48:22 EST ID:mbgL4xKu No.18349 Ignore Report Quick Reply
it is doing something, but it does not bring me to frame 1 of the timeline.
it only stops the moving object in it's initial position when I replace ' this._alpha = 20 ' for that line.

this is what i did: _root.obstacle.gotoAndStop(1)
without the second _root at least it does somehting
maybe i did something wrong, but i put this line in



since nothing happens when I put it like this
"_root.obstacle_root.gotoAndStop(1)"
"_root." i.e. "_root.gotoAndStop(1)"
>>
Clara Digglewin - Thu, 14 Jun 2012 10:51:28 EST ID:ny4x1gdf No.18357 Ignore Report Quick Reply
1339685488816.gif -(2999 B, 357x337) Thumbnail displayed, click image for full size. 2999
>it only stops the moving object in it's initial position when I replace ' this._alpha = 20 ' for that line.

if you want it to hit your "spin trap";

>if (_root.obstacle.hitTest(this._x, this._y, true)) { _root.gotoAndStop(1) }

------

if you want it to hit 'everything';

>if (_root.circle.hitTest(this._x, this._y, true) || _root.obstacle.hitTest(this._x, this._y, true) ) { _root.gotoAndStop(1); }
--
>>
Albert Drurrymetch - Tue, 10 Jul 2012 07:14:01 EST ID:mbgL4xKu No.18476 Ignore Report Quick Reply
Dragan Doolhof.swf -(21489 B, 0x0) Thumbnail displayed, click image for full size.
>>18357
hey thanks, i figured it out.. sort of.
it works, but not 100%. it was an assignment for school, and the teacher liked it, so i guess it's good enough. :)

thanks everyone for helping


Report Post
Reason
Note
Please be descriptive with report notes,
this helps staff resolve issues quicker.