Jump to content
Search Community

forceSelectionToFront problem [SOLVED]

venkata77 test
Moderator Tag

Recommended Posts

Hi,

 

I am using AS2 version of TransformManager.

 

However, I am failed to forceSelectionToFront of selected object.

 

Here is the link for testing.

 

http://121.169.208.177/editor/editor.html

 

Use rightside panel to add objects on board. You can see adding texts, drawings, images etc.

 

Her is my code.

 

manager_obj = new gs.TransformManager({targetObjects: [samp], bounds: {xMin: 0, xMax: canvas_mc._width, yMin: 0, yMax: canvas_mc._height}, forceSelectionToFront: true, autoDeselect: false, eventHandler: onAnyEvent});

 

where I am getting wrong?

 

You can two objects from right side selection and check it out.

 

Thanks in advance.

 

Regards,

Link to comment
Share on other sites

I'd need to see the rest of your code to know what the problem is for sure.

 

Keep in mind that I believe the TransformItems must share the same _parent which is where the selection handles will be drawn, etc. So if you're nesting your MovieClips in ways that don't conform to that, you'll likely run into trouble.

Link to comment
Share on other sites

Hi,

Here is the rest of the code.

Hope this helps.

 

/* This function add emoticon to canvas_mc with given ID */

function fAddEmoticon(xp, yp, xscale, yscale, ID)

{

var __reg3 = canvas_mc.attachMovie("rect", "emo" + canvas_mc.getNextHighestDepth(), canvas_mc.getNextHighestDepth());

 

var __reg2 = __reg3.attachMovie(ID, ID + __reg3.getNextHighestDepth(), __reg3.getNextHighestDepth());

 

__reg2._x = xp;

__reg2._y = yp;

__reg2._xscale = xscale;

__reg2._yscale = yscale;

 

 

manager_obj.addItem(__reg2)

 

}

canvas_mc.setMask(mask_mc);

manager_obj = new gs.TransformManager({targetObjects: [samp], bounds: {xMin: 0, xMax: canvas_mc._width, yMin: 0, yMax: canvas_mc._height}, forceSelectionToFront: true, autoDeselect: false, eventHandler: onAnyEvent});

 

Thanks in advacnce.

 

Regards,

Link to comment
Share on other sites

Right. It looks like you're violating the _parent rule. Every time fAddEmoticon() gets called, you're creating a MovieClip within another MovieClip and adding that nested MovieClip to TransformManager, so every one of them will have a different parent. See what I mean? Maybe try adding __reg3 instead of __reg2.

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...