LOADING
Loading
Hi , welcome back.
LogoutLOGOUT
 
  Lost password?  
Hi
 


Prev Previous Post   Next Post Next
  #1  
Old 09-01-2004, 06:21 PM
zetta04 zetta04 is offline
Registered User
 
Join Date: Aug 2004
Location: USA
Posts: 4
Rep Power: 0
zetta04 is on a distinguished road
Shuffle code

I am using the following code to shuffle MC's in a puzzle


Actionscript:
on (release) {
    for (var i = 1; i<16; i++) {
        with (this["p"+i]) {
            _x = Math.floor(Math.random()*400)+180;
            _y = Math.floor(Math.random()*400)+60;
            _rotation = Math.floor(Math.random()*2)*90;
        }
    }
}

It works fine except when you move pieces and then hit the shuffle button.
In testing the following error message pops up:

Error: A 'with' action failed because the specified object did not exist.

In play, all MC's shuffle except any that were dragged prior to hitting the shuffle button. Why would moving an MC a few pixels cause this? The MC hasn't been 'removed' from the main movie.
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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

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

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Code to make Flash movie clips shuffle thevibe Flash CS4 1 10-27-2009 10:14 AM
optimizing code orderofout Actionscript 2.0 3 10-25-2007 02:39 PM
Adobe's code only, still not compiling saumya ActionScript 3.0 3 04-26-2006 03:54 PM
Slide In Background (Need Advice on Code) TymeAw8z Flash MX 5 07-25-2005 03:55 PM
Problems with XML code from reference book. PUP100 XML & Sockets 0 01-07-2005 12:07 PM




All times are GMT. The time now is 08:35 AM.