Help! Im to lazy!
A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Help! Im to lazy!

  1. #1
    Senior Member
    Join Date
    Jul 2000
    Posts
    198
    I have 1600 squares that i have to give seperate instance names, 1-1600. Im doing this to make a map editor for a game. I was wondering if there was any way to name them all in actionscript. If any one knows, please help! Im too lazy to name each one!

    PS - How do you get the flash banner in your signature?

  2. #2
    Senior Moderator
    Join Date
    Apr 2000
    Location
    Sheffield, UK
    Posts
    3,881
    Heres how:


    put this code on one frame:

    set variable: "wide" = "how may cells wide"
    set variable: "high" = "how may cells high"


    then create a movieclip for your cells and name it "movA1"

    then put this code:
    Set Variable: "/:x" = GetProperty ( "/movA1", _x)
    Set Variable: "/:y" = GetProperty ( "/movA1", _y)
    Set Variable: "/:h" = GetProperty ( "/movA1", _height)
    Set Variable: "/:w" = GetProperty ( "/movA1", _width)
    Set Variable: "/:row" = "0"
    Set Variable: "/:col" = "1"
    Set Variable: "/:i" = "1"
    Set Variable: "/:f" = "1"
    Set Variable: "/:max" = (/:wide*/:high)-1
    Set Variable: "/:d" = "2"
    Loop While (/:i<(/:max+1))
    Set Variable: "/:b" = /:i-/:a
    If (/:b =/:wide)
    Set Variable: "/:a" = /:a+/:wide
    Set Variable: "/:row" = /:row+1
    Set Variable: "/:col" = "0"
    Set Variable: "/:what" = /:i
    End If
    Duplicate Movie Clip ("/movA1", /:i+1, /:i+1)
    Set Property (/:i+1, X Position) = /:x+(/:w*/:col)
    Set Property (/:i+1, Y Position) = /:y+(/:h*/:row)
    Set Variable: "/:i" = /:i+1
    Set Variable: "/:d" = /:d+1
    Set Variable: "/:col" = /:i-/:what
    If (/:d=27)
    Set Variable: "/:d" = "1"
    End If
    End Loop
    Stop


    that will duplicate the movielcips and align them correctly!!

    Hope thats Saved u some time!!
    Regards FlashGuru

    p.s youll have to experiment with the wide and high variables cos the number of cells it duplcaites is wide X high




Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width


HTML5 Development Center

Poll by Flashkit.com