Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 04-29-2012, 04:55 PM   #21
jenn_tran
Member
 
Join Date: Apr 2012
Posts: 78
Default

its the error i get quite often when i modify the .as file 1180:Call to possibly undefined method shuffle.
jenn_tran is offline   Reply With Quote
Old 04-29-2012, 04:58 PM   #22
sparX
!Senior Member
 
Join Date: Jan 2010
Posts: 1,675
Default

The method is identified as
'shufflePieces'
jenn.
Call
ActionScript Code:
puzzle.shufflePieces();
on the mainTimeline.
sparX is offline   Reply With Quote
Old 04-29-2012, 05:00 PM   #23
sparX
!Senior Member
 
Join Date: Jan 2010
Posts: 1,675
Default

Also, make sure you saved the file when you edited it.
Flash does that stupid thing of not saving files before you build...
sparX is offline   Reply With Quote
Old 04-29-2012, 05:07 PM   #24
jenn_tran
Member
 
Join Date: Apr 2012
Posts: 78
Default

Do i put it after all the button codes? i'm getting 3 1120 errors now all saying Access of undefined property puzzle.
jenn_tran is offline   Reply With Quote
Old 04-29-2012, 05:09 PM   #25
jenn_tran
Member
 
Join Date: Apr 2012
Posts: 78
Default

Ya got it that was my fault sorry i deleted something by mistake. works awesome. thank you sooooo much. sweet dreams!
jenn_tran is offline   Reply With Quote
Old 04-29-2012, 05:13 PM   #26
sparX
!Senior Member
 
Join Date: Jan 2010
Posts: 1,675
Default

I had too much icecream for dessert...
gonna have some savoury dreams instead...
sparX is offline   Reply With Quote
Old 04-29-2012, 05:22 PM   #27
jenn_tran
Member
 
Join Date: Apr 2012
Posts: 78
Default

Lol
jenn_tran is offline   Reply With Quote
Old 05-01-2012, 08:07 PM   #28
jenn_tran
Member
 
Join Date: Apr 2012
Posts: 78
Default

Now i'm trying to add drag and drop function to the puzzleObject (pieces) i add the code below to my class file but when i call the function to my main timeling i get this error 1136 incorrect number of arguments. expected 0
Any idea what i'm doing wrong?? thank you Jenn
ActionScript Code:
// Adds Drag and drop to pieces                 public function dragDrop()         {             addEventListener(MouseEvent.MOUSE_DOWN, drag);         }         public function drag(event:MouseEvent):void         {             startDrag();             stage.addEventListener(MouseEvent.MOUSE_UP, drop);         }         public function drop(event:MouseEvent):void         {             stopDrag();             stage.removeEventListener(MouseEvent.MOUSE_UP, drop);         }
jenn_tran is offline   Reply With Quote
Old 05-01-2012, 09:24 PM   #29
sparX
!Senior Member
 
Join Date: Jan 2010
Posts: 1,675
Default

Almost jenn.
When you get an error from something, paste the whole error into your reply, it usually contains other info that is useful.
Also include the code that is giving you the error.
Like what was the function call you made?
You may have been doing something like
puzzle.dragDrop(someParameter) or similar.

The main problem you have, is you need to target individual pieces of the puzzle, the code you have there will just pick up the whole puzzle & drag it, ie your call to startDrag() will be resolved to this.startDrag() which is a reference to the whole Puzzle instance.

Just call puzzle.dragDrop() from you're mainTimeline(with no parameters), when you want to allow the pieces to be dragged.
I've included a little exercise for you

ActionScript Code:
public function dragDrop():void {     //buttonMode = true; // hand cursor if you desire...     addEventListener(MouseEvent.MOUSE_DOWN, drag); } private function drag(event:MouseEvent):void {     var pieceMousedDownOn:Sprite = Sprite(event.target);     // homework     // hmmmm... some pieces are behind others when I drag...     // what could I "add" here to fix it???     pieceMousedDownOn.startDrag();     stage.addEventListener(MouseEvent.MOUSE_UP, drop); } private function drop(event:MouseEvent):void {     stopDrag();     stage.removeEventListener(MouseEvent.MOUSE_UP, drop); }
sparX is offline   Reply With Quote
Old 05-01-2012, 10:25 PM   #30
jenn_tran
Member
 
Join Date: Apr 2012
Posts: 78
Default

Yay me, I got one. Well I hope it's right, it works.

Now i'm on to try to figure out how to make the piece dropped snap into the place of the piece its over top of, and have the two pieces swap places. I am hopeful.

ActionScript Code:
addChild(pieceMousedDownOn);
jenn_tran is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 07:28 AM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.