Solved

URGENT: Can't get gotoAndPlay work inside an onRelease function

Posted on 2007-11-22
4
876 Views
Last Modified: 2008-02-01
Here you can find my FLA file http://dropbox.aiwmedia.com/gotoAndPlay.fla.

On frame 2 of the _root i have some lines of actionscript that control the box being dragged. The box is meant to be dragged to one of the three hitZones (the vans). On line 26 you can see an onRelease function for the box that checks if the box is on one of the drop zones and if it is it should then gotoAndPlay(21) the relevant frame in the boxContainer clip. The gotoAndPlay(21) statment is on line 31.

I can't get this gotoAndPlay to work, as you can see the trace works and proves that the if statment runs correctly. I have tried many different paths but i can't seem to find anyway to get the gotoAndPlay(21) to work. What am i doing wrong?
0
Comment
Question by:alex_wareing
  • 3
4 Comments
 
LVL 18

Expert Comment

by:Antonio Estrada
ID: 20334995
I can't open your *.fla for some reason... Are you using Flash CS3?

Well anyway, I'd try to place a _root. before the gotoAndPlay() statement, it may help.

-V
0
 

Author Comment

by:alex_wareing
ID: 20335032
Yes its CS3. I have reuploaded in flash 8 format. I have tried _root and that didn't work
0
 
LVL 18

Accepted Solution

by:
Antonio Estrada earned 500 total points
ID: 20335511
Ah, I see it now.

Check this code:

<code snippet>

You were making reference to a child object (box) of the boxContainer on the events, with this it now works correctly...

If you need anything else, let me know.

-V
boxContainer.onPress = function() { 
	startDrag(this,true);
	this._width = 77;
	this._height = 65;
}
boxContainer.onRelease = function() {
	stopDrag();
	if (this.hitTest(_root.wagonJob.dropJob)) {
		trace("Hit Job");
	} else if (this.hitTest(_root.wagonBatch.dropBatch)) {
		this.gotoAndPlay(21);
		trace("Hit Batch: " + this);
	} else if (this.hitTest(_root.wagonFlow.dropFlow)) {
		trace("Hit Flow");
	} else {
		this._width = 100;
		this._height = 85;
		this._x = -30;
		this._y = -30;
	}
}

Open in new window

0
 
LVL 18

Expert Comment

by:Antonio Estrada
ID: 20335547
Lines 18 and 19 of should change though...

this._x = 167;
this._y = 297;

And maybe some other lines like this._width=100; and this._height=85; should be just after stopDrag();

-V
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are times in your Flash CS4 application when you want more than a simple pointer or a hand, and it's hard to find an ideal walk-through to tell you what to do.  I spent a few days recently learning my way around making custom cursors in Flash,…
While working over numerous projects I often had the requirement for doing a screen capture in AS3.0. Unfortunately I found no "ready made" solutions in google search that suited my requirements. But I did come across some great resources which help…
The goal of the tutorial is to teach the user how to live broadcast using Flash Media Live Encoder and connecting it to YouTube to broadcast. Log into your Youtube account, choose live stream settings, start live stream from Flash Media Live Enc…
The goal of the tutorial is to teach the user how to how to record live broadcast.

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question