Flasher Archive

[Previous] [Next] - [Index] [Thread Index] - [Previous in Thread] [Next in Thread]


Subject: FLASH: Re: What is wrong with this loop? (Scott Jeppersen)
From: Oliver Emberton
Date: Thu, 16 Mar 2000 09:22:33 GMT


>> "Scott Jeppesen" <sjeppesenatuniversityaccess [dot] com> 03/15/00 08:34pm >>>
>> What is wrong with this loop? I am trying to take a MC(in this case a dot)
>> and make 9 copies spaced 20px apart. Something is up with the loop. It makes
>> one copy and moves it then x jumps to 10 and the loop stops running. What
>> have I done wrong?

>> Here is my code:
>> Set Variable: "x" = 2
>> Set Variable: "ypos" = GetProperty ("/dot1",_y)
>> Loop While (x < 10)
>> Duplicate Movie Clip ("/dot1", "dot"&x, 1)
>> Set Property ("dot"&x, Y Position) = ypos + 20
>> Set Variable: "x" = x + 2
>> End Loop


Several problems with your code:

Firstly, Duplicate Movie Clip needs a different 'depth' for each copy - all your copies are on layer 1, and end up replacing each other.

Try this:
Duplicate Movie Clip ("/dot1", "dot"&x, x+1)

Secondly, your loop starts x at 2 and goes up in steps of 2. How is this supposed to create 9 dots?
Finally, the Y position is set to a fixed value: ypos + 20. This should change with relation to the value of x

This should fix all problems:

Set Variable: "x" = 1
Set Variable: "ypos" = GetProperty ("/dot1",_y)
Loop While (x < 10)
Duplicate Movie Clip ("/dot1", "dot"&x, x+1)
Set Property ("dot"&x, Y Position) = ypos + (20*x)
Set Variable: "x" = x + 1
End Loop


Hope this helps


Oliver Emberton
Internet Development Manager, Datamex
www.datamex.co.uk

-------------------------------------------------------------------------------------------------------------------------------------------------------------------




flasher is generously supported by...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
flashforward2000 and The Flash Film Festival
"The World�s Premier Flash Solutions Conference and Expo"
March 27-29, Nob Hill Masonic Center, San Francisco, California

-Register before Feb 25 and save $200!!-- www.flashforward2000.com
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To unsubscribe or change your list settings go to
http://www.chinwag.com/flasher or email helpatchinwag [dot] com


[Previous] [Next] - [Index] [Thread Index] - [Next in Thread] [Previous in Thread]