AllExperts > Experts 
Search      

Shockwave Flash

Volunteer
Answers to thousands of questions
 Home · More Questions · Answer Library  · Encyclopedia ·
More Shockwave Flash Answers
Question Library

Ask a question about Shockwave Flash
Volunteer
Experts of the Month
Expert Login

Awards

About Us
Tell friends
Link to Us
Disclaimer

 
 
 
 
About Mike Dixon
Expertise
I can answer most flash related questions. I am not at this time expert using action script 3.

Experience
Using flash since version 4. currently web director.

Education/Credentials
certified ;)

 
   

You are here:  Experts > Computing/Technology > Web Design > Shockwave Flash > Flash 8

Topic: Shockwave Flash



Expert: Mike Dixon
Date: 6/28/2008
Subject: Flash 8

Question
Is it possible to click attached movieclips in Flash 8?

I have one movieclip on the scene. When I click on it I attache another one with "movieclip.attach". Problem is how do I click that second movieclip?
I've tried this code wich doesn't work:
on(press)
{attachMovie("box","box",1)}

box.onPress=function(){trace("box")}

Answer
Nerijus,

You need to assign an unique identifire to new movieclips created with attachMovie. In your example where it is hard coded, it is simple -

attachMovie("box","newBox",1);

newBox will be the name of the newly created clip, and you will use this to contol it - newBox.onPress = function(){

Usually attachMovie is used dynamically and the new name is made by attaching "i" to the name - "box", "box"+i. I recommend reading the flash help on this method, as you will at some point need to create these dynamically and will need to generate higher levels also. It will help you understand exactly how it works. This method is very powerful to the experienced coder. Definately one of the most useful methods in AS2...




hope this helps

~mike.dixon

Add to this Answer    Ask a Question



  Rate this Answer
   Was this answer helpful?
Not at allDefinitely              
   12345  

     
About Us | Advertise on This Site | User Agreement | Privacy Policy | Help
Copyright  © 2008 About, Inc. About and About.com are registered trademarks of About, Inc. The About logo is a trademark of About, Inc. All rights reserved.