I basically modeled my project’s behavior very closely to this. Here is the structure of my fla file. I have a MC called “component library”, which contains another MC called “office”. In the “office” MC, there are two types of office buildings, lowrise and midrise. I made graphic symbols for lowrise and midrise, and set the Linkage Property on them. For example, I gave the symbol “lowrise” a linkage identifier: lowrise1a. Then I dragged the “lowrise” symbols onto the “office” MC, and convert it to a MovieClip with an instance name “original-lowrise1a”. Then I went into the “original-lowrise1a” MC, and defined the frame action for duplicated drag and drop.
Please refer to this file: http://sqlin_1.tripod.com/test/HelpRotateMC.zip (please right-click and save as…)
However, I want the movieclip lowrise to be rotatable. Like in http://www.type289.com/clients/colorforms/test.swf, when the user clicks on the MC after dragging it from the lower panel, there are two small rotation handle on the upper right hand corner and the lower left hand corner. The user then can rotate around using the mouse (not arrow keys). This is exactly what I need for this project. Can someone please help? Anything (tutorials, references, suggestions) will be highly appreciated!
Hi Flex,
I checked out the example using the component, it’s exactly what I was looking for. However, after installing the extension, I did not know how to use it. Can you help me with that?
What I did:
create a MC that contains the graphical symbol of the object I want to rotate
It’s very simple. If you have a movieclip called “mc1”, drag the component over it. I’m not sure how you have your panels laid out but if it is the default then at the bottom of the screen, the parameters for the component should appear (you swap between the properties and parameters tab). All you need to do is make sure that you change the “target MC” to that of your mc, in the case of this example “mc1”.
And thats it. You should be ok with the rest of the values as default.
If you still can’t see the parameters, click on one of the small blue squares on the component (that should be on top of your movieclip), right click on it and go to properties, then change to the parameters tab and change the “target MC” paramter.
Thank you for the instruction on using the component, and the adjuster component does everything I was looking for. However, what I am trying to do is to incorporate the rotation into the duplicated draggable MC. For some reason so far I could get the rotation to work, but I cannot make the rotatable MC draggable or duplicated, which is very important for the project that I am doing. Allow me to explain a bit of what I am doing here
create a graphic symbol “box0”. set linkage property
drag “box0” onto the main stage and convert it into a MC called “box”
go into the “box” mc in frame1 insert the following code for duplicating MC by the attachMovie method
on main stage, drag the adjuster component over it and set the target MC as “box”.
This is one of the 100 things I’ve tried so far. I think I want to set the rotation method on the MC (in this case box), and when it’s dragged onto the stage or duplicated, the rotation method should be preserved. I am really running out of ideas now. If you could help, that would be great!!
I think the target MC would have to say not only box, because that would target only box and not any other duplicated clips, as their instance name would be different.
I don’t know if you can use a string that allows for the box or any duplicated mcs of the box. Also I noticed you’re using startDrag(); for the movie clips. I’m not sure if you should, because the component takes care of all those properties, so by using it, you might interfere with the functionality of the component - I’ll have a look, can you post a fla?
It’s up to the user. Ideally the user selects a piece and drag it onto a map. He/she can select multiple instances of the same piece and arrange them by rotating them.
Because I am using a attachMovieClip function, I thought all the duplicated instances will have the same Id, the thing that’ s different is their counter, the variable d.
I see why you needed the startDrag(); but I still don’t know if it interferes with the component. The component only accepts the name of one instance of a movie clip - and doesn’t accept expressions like “clip”+count, newdepth, etc.
I also realize the interference problem between what I already have (duplicated MC) and the component, therefore I thought of a much simpler approach: have a button called “rotate” to rotate the currently selected MC. Of course, the tricky part is how to fine what’s the current MC.
Here is a simple test:
I have a MC called “ct” (instance name), and in it, there is another mc with ID “lowrise2”. I went into “lowrise2” and defined the actionscript for duplicating MC (this is the same as before).
I then create and place a button “rotate” on the main stage, and put the following action on the button:
When I run it, the button only rotates the first MC duplicated from lowrise2. Ideally when the user clicks on one MC, the button “rotate” will somehow know its ID and the counter, so it only rotate that particular MC. So my question is how to contruct the variable that goes into the [ ] bracket for “ct”? I think it’s a question about how to communicate between a MC and a button at different levels, and I am really clueless…
The button needs to know which movie clip to target for the rotation. It’s worth having a look at the source of the component to see if anything there mentions being able to use expressions or strings. I’ll have a look at the fla.
Actually there is something in the instructions detailing how attach the adjuster with actionscript instead of just dropping it onto a movie clip. Drop the component onto an mc and look at the code for the adjuster. I’m seeing if this will work…
I came across this fla. It has buttons changing the x and y scale of the movie clip and you can rotate the movie clip. The code is applied to the movie clip so any duplicates should be the same.