Jump to content
Search Community

TransformEvent.SELECT Problem [SOLVED]

cactusphone test
Moderator Tag

Recommended Posts

My Class is shown below, the onScale listener function fires and displays the trace. However the onSelectClip1 produces no output. Anyone know why this might be happening? If it helps shed any light, the Delete function seems to also not be working, I tested it after uploading my swf, as opposed to in Flash itself. Thanks.

public class GraphicItem extends Sprite {

	public var theSprite:Sprite = new Sprite();
	public var loader:Loader = new Loader();  
	public var manager:TransformManager = new TransformManager({targetObjects:[theSprite],constrainScale:true,arrowKeysMove:true,allowDelete:true});	

public function GraphicItem() {
}

public function AddSrc(src:String){

		var request:URLRequest = new URLRequest(src);  

		loader.load(request);

		loader.mouseEnabled = false;

		theSprite.addChild(loader);

		addChild(theSprite);
		manager.addEventListener(TransformEvent.SELECT, onSelectClip1);
		manager.addEventListener(TransformEvent.SCALE, onScale);

}

	function onSelectClip1($e:TransformEvent):void {

		trace("selected myClip1");

	}

	function onScale($e:TransformEvent):void {

		trace("Scaled " + $e.items.length + " items");

	}

}

Link to comment
Share on other sites

Yes, that's expected behavior - TransformManager dispatches SELECTION_CHANGE events whereas TransformItems dispatch SELECT events.

 

If you want to listen for when theSprite gets selected, you can set up a listener on the corresponding TransformItem, like this:

 

var myItem:TransformItem = manager.getItem(theSprite);
myItem.addEventListener(TransformEvent.SELECT, onSelectClip1);

 

Make sense?

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.
×
×
  • Create New...