Solved

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

Posted on 2007-11-22
4
878 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

I come across a lot of question about how to access things in the document class from a movieclip, or accessing something from a movieclip in the document class. It took me a while to figure this out but once I did it makes life so much easier. …
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 set there setting in Adobe Flash Media Live Encoder and YouTube for optimal video and audio quality.
The goal of the tutorial is to teach the user what frame rate is, how to control it and what effect it has on the video.

726 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