Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
hano

Transforming dynamic assets

Recommended Posts

Hi :)

I seem to have a problem with Transform Manager..

I'm loading in new squares by clicking on the original square movieclip,, and I want the new squares to be transformable..

Is there something wrong with my code?

Any help appreciated!

 

import com.greensock.transform.TransformManager;

import com.greensock.events.TransformEvent;

 

var newSquare:MovieClip;

//this is the duplicate square variable

 

var manager:TransformManager = new TransformManager({targetObjects:[newSquare], addItem:(newSquare),bounds:new Rectangle(0, 0, 550, 365)});

 

square_mc.addEventListener(MouseEvent.CLICK, addSquare);

//here im adding the new squares

 

function addSquare(e:MouseEvent):void {

newSquare = new Square();

newSquare.x = stage.x/2 + stage.width/2;

addChild(newSquare);

 

newSquare.addEventListener(MouseEvent.MOUSE_DOWN, dragIt);

newSquare.addEventListener(MouseEvent.MOUSE_UP, stopdragIt);

}

Link to comment
Share on other sites

There seem to be a lot of mistakes in that code. I assume you meant something more like:

 

var manager:TransformManager = new TransformManager({bounds:new Rectangle(0, 0, 550, 365)});

square_mc.addEventListener(MouseEvent.CLICK, addSquare);

function addSquare(e:MouseEvent):void {
   newSquare = new Square();
   newSquare.x = stage.x/2 + stage.width/2;
   addChild(newSquare);
   manager.addItem(newSquare);
}

 

Right?

Link to comment
Share on other sites

Yep, that works great except for one thing, when I let go, or try resize the movieclip the transform handles move in a different direction.. any clues?

Link to comment
Share on other sites

Actually nevermind :) I fixed that by removing the drag and strop drag functionality I had attached to it

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×