Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
Sign in to follow this  
balaganesh

Transform addItem Not Working

Recommended Posts

Hi,

 

I created one MovieClip inside another MovieClip and loaded the image using LoadClip. After that, if I add that created movieClip to Transform Manager It is not getting added. Please help me to do this.

 

follwoing is the code I used

 

import gs.TransformManager;

import gs.TransformItem;

import gs.TransformEvent;

 

var TmanagerObj = new TransformManager();

 

my_mc = new MovieClipLoader();

var empty_mc:MovieClip = _root.front_outer_mc.createEmptyMovieClip("front_art_mc", 10);

 

empty_mc._x = 180;

empty_mc._y = 150;

var preload:Object = new Object();

my_mc.addListener(preload);

 

preload.onLoadInit = function (targetMC:MovieClip):Void {

var wd:Number = (targetMC._width/2);

var hg:Number = (targetMC._height/2);

 

targetMC._width = wd;

targetMC._height = hg;

var mc3Item:TransformItem = TmanagerObj.addItem(front_art_mc_102);

my_mc.removeListener(preload);

}

 

my_mc.loadClip("test.swf", "front_outer_mc/front_art_mc");

 

thanks!

Link to post
Share on other sites

It looks like you are using an ancient free AS2 version of TransformManager that hasn't been supported for many, many years. The AS2 version was completely redesigned and improved years back at which time support for the free version stopped. You're still welcome to use that old version, though.

 

It looks to me like maybe it's a scope issue in your onInit() method. Have you tried referencing _root.front_art_mc instead of just front_art_mc?

 

I'd definitely recommend using the newer version because it has huge improvements and added features. http://www.greensock.com/transformmanageras2/ (or there's an AS3 version of course)

Link to post
Share on other sites

Hi,

 

Thanks your reply. Now the Transform manager is working. But I am phase another issue. I will explain what i want,

 

1. I have one outer movieClip in the name of "outer"

 

2. Inside that i need to load multiple art and each art i need to apply transform manager

 

3. So, I created emptyMovieClip each time when user click the add Art button.

 

4. And I load the particular art to that movieClip.

 

5. After I apply the Transform manager using AddItem.

 

6. First Item loaded and applied the Transform Manager successfully. I move the art little bit and i click add art button. so, it loaded second art

 

7. Second art also have the Transform manager. But if i selected the first art the transform Manager not working.

 

Following code i used. "btn_mc" and "btn_mc1" are two button.

 

System.security.allowDomain('*');
import gs.TransformManager;
import gs.TransformItem;
import gs.TransformEvent;

var TmanagerObj =  new TransformManager();

var i = 120;

function createArt(clpurl:String) {

i++;
var mcNama = "itemHolder" + i;

var adjustLoader = _root.outer.createEmptyMovieClip("itemHolder" + i, i);

var empty_mc = adjustLoader.createEmptyMovieClip("front_art_mc" + i, i);		

mcLoader = new MovieClipLoader();
mcLoaderListener = new Object(); // Object initialization	

mcLoaderListener.onLoadInit = function (targetMC:MovieClip) {	
	var wd:Number = (targetMC._width/2);
	var hg:Number = (targetMC._height/2);

	targetMC._width = wd;
	targetMC._height = hg;

	TmanagerObj.addItem(outer[mcNama]);
}

mcLoader.addListener(mcLoaderListener);
mcLoader.loadClip(clpurl, empty_mc);
}

btn_mc.onRelease = function () {
createArt("01.swf");
}

btn_mc1.onRelease = function () {
createArt("36.swf");
}

 

But if i create the emptyMovieClip in root is working perfectly. Just replace this two line it will working perfectly.

 

  
    Replace "var adjustLoader = _root.outer.createEmptyMovieClip("itemHolder" + i, i);"  To  "var adjustLoader = _root.createEmptyMovieClip("itemHolder" + i, i);"
    Replace "TmanagerObj.addItem(outer[mcNama]);"  To "TmanagerObj.addItem(_root[mcNama]);"

 

I not able to fine the where is the problem in my code.

 

Thanks!

 

Please Help Me.

Link to post
Share on other sites

It looks like exactly the same problem you asked about before - a scope issue. Have you tried this?:

TmanagerObj.addItem(_root.outer[mcNama]);

 

Also note that the very old free AS2 version of TransformManager hasn't been supported for many years. If you'd like support (and a much richer feature set), I'd highly recommend purchasing the latest version.

Link to post
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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×