A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: is it possible to get property of multiple mc?

  1. #1
    Member
    Join Date
    Jul 2000
    Posts
    37
    in stage i got 2 mc positioned differently.the mc using the same movieclip with different instances, let's called it ant so there's ant1 and ant2 and the name of the mc is ants. inside mc ants, i have another mc with instance called ant, I put a script from the ant to detect ant1 position on the stage:

    Set Variable: "bugx" = GetProperty ("_level0/ant1",_x )
    Set Variable: "bugy" = GetProperty ("_level0/ant1",_y )

    how can i detect the position of the ants (ant1,ant2,and possibly 3..4..and so on) at the same time using just 1 script from the ant mc?

    thanks 4 help if you got any question email me

  2. #2
    Senior Moderator
    Join Date
    Apr 2000
    Location
    Sheffield, UK
    Posts
    3,881
    set variable: "loopcount" = "1"
    loop While(loopcount <= 4)
    Set Variable: "bugx" & loopcount= GetProperty ("_level0/ant" & loopcount,_x )
    Set Variable: "bugy" = GetProperty ("_level0/ant" & loopcount,_y )
    set variable:"loopcount" = loopcount + 1
    end loop

    Hope that helps!!
    regards FlashGuru

  3. #3
    Member
    Join Date
    Jul 2000
    Posts
    37

    flashguru

    I just fix my script and put yours in, but when i test the movie and check the variables, it turns out that the loopcount variables =5 and it does not want to include ant number1 and 2, so i just change the script position and put it inside mc "ants" instead of putting it in mc "ant", but it still does not work out the problem..what's wrong? can u help me out on this?

  4. #4
    Member
    Join Date
    Jul 2000
    Posts
    37

    flashguru..again

    i just notice from your script in the variable window when i test the movie..instead of putting

    "_level0/ant"&loopcount (suppose to put as ant1..ant2..etc)

    it does put the variable "bugx" and "bugy" as bugx1..bugx2..etc.

    If (_level0:realx<bugx+z and _level0:realx>bugx-z and _level0:realy<bugy+z and _level0:realy>bugy-z )
    detect collision!!
    End If

    since i want to detect a collision between the ant and another object so i have to use "bugx" and "bugy" variable instead of "bugx1".."bugx2"..and so on

    maybe you can fix it somehow =)
    thank you

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