Flash Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsWeb DesignFlash Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old January 17th, 2004, 12:34 PM
mg8's Avatar
mg8 mg8 is offline
SAWEET
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Location: New York
Posts: 128 mg8 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 13 h 31 m 40 sec
Reputation Power: 5
Send a message via AIM to mg8 Send a message via MSN to mg8
Changing _y of each element in array with loop...

I have this code:

karate.onRelease = function()
{
karateOpen();
}

function karateOpen()
{
array = new Array("elem","karate","jh","hs","duke");
for (var i=0;i<array.length;i++)
{
if (array[i] != "karate")
{
with(array[i])
{
_y += 40;
}
}
}
}


What I want is for each button to move down 40 when the karate button is pressed. The problem is the instead of each moving down individually, they are all moving down together...like all the buttons are one button and it's moving it.

Thanks

Reply With Quote
  #2  
Old January 17th, 2004, 02:26 PM
Tann San Tann San is offline
Gotta get to the next screen..
Click here for more information.
 
Join Date: Nov 2003
Location: Legion of Dynamic Discord
Posts: 4,584 Tann San User rank is Colonel (50000 - 60000 Reputation Level)Tann San User rank is Colonel (50000 - 60000 Reputation Level)Tann San User rank is Colonel (50000 - 60000 Reputation Level)Tann San User rank is Colonel (50000 - 60000 Reputation Level)Tann San User rank is Colonel (50000 - 60000 Reputation Level)Tann San User rank is Colonel (50000 - 60000 Reputation Level)Tann San User rank is Colonel (50000 - 60000 Reputation Level)Tann San User rank is Colonel (50000 - 60000 Reputation Level)Tann San User rank is Colonel (50000 - 60000 Reputation Level)Tann San User rank is Colonel (50000 - 60000 Reputation Level)Tann San User rank is Colonel (50000 - 60000 Reputation Level)Tann San User rank is Colonel (50000 - 60000 Reputation Level)  Folding Points: 7835 Folding Title: Novice Folder
Time spent in forums: 3 Weeks 5 h 57 m 29 sec
Reputation Power: 534
Facebook MySpace
Hi, sounds like you want a pause. This might do what you want:
Code:
karate.onRelease = function()
   {
        karateOpen();
   }

function karateOpen()
   {
        if(count < maxCount)
           {
                if (array[count] != "karate")
                     {
                          array[count]._y += 40;
                     }
                count++;
            }
         else
            {
                clearInterval(pauser);
            }
   }

function init()
   {
         array = new Array("elem","karate","jh","hs","duke");
         maxCount = array.length;
         count = 0;
         pauser = setInterval(karateOpen, 100);
   }

init();


It probably needs some tweaking but it should be enough to give you the general idea. lower the second value for setInterval to reduce the time between function calls.
__________________
-Tann

-Vote for your favorite ActionScript editor here.

Reply With Quote
  #3  
Old January 17th, 2004, 02:51 PM
mg8's Avatar
mg8 mg8 is offline
SAWEET
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Location: New York
Posts: 128 mg8 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 13 h 31 m 40 sec
Reputation Power: 5
Send a message via AIM to mg8 Send a message via MSN to mg8
whenever I try something like this:

array[i]._y

It tells me it is undefined.

Reply With Quote
  #4  
Old January 17th, 2004, 03:04 PM
Tann San Tann San is offline
Gotta get to the next screen..
Click here for more information.
 
Join Date: Nov 2003
Location: Legion of Dynamic Discord
Posts: 4,584 Tann San User rank is Colonel (50000 - 60000 Reputation Level)Tann San User rank is Colonel (50000 - 60000 Reputation Level)Tann San User rank is Colonel (50000 - 60000 Reputation Level)Tann San User rank is Colonel (50000 - 60000 Reputation Level)Tann San User rank is Colonel (50000 - 60000 Reputation Level)Tann San User rank is Colonel (50000 - 60000 Reputation Level)Tann San User rank is Colonel (50000 - 60000 Reputation Level)Tann San User rank is Colonel (50000 - 60000 Reputation Level)Tann San User rank is Colonel (50000 - 60000 Reputation Level)Tann San User rank is Colonel (50000 - 60000 Reputation Level)Tann San User rank is Colonel (50000 - 60000 Reputation Level)Tann San User rank is Colonel (50000 - 60000 Reputation Level)  Folding Points: 7835 Folding Title: Novice Folder
Time spent in forums: 3 Weeks 5 h 57 m 29 sec
Reputation Power: 534
Facebook MySpace
Hi, oh...well a couple of things pop to mind. Its never really a good idea to call things the same as functions/methods i.e. array. try enclosing it in an eval statement i.e.:

eval(array[count])._y = whatever;

If that doesnt work switch back to using your with() clause.

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignFlash Help > Changing _y of each element in array with loop...


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway