Jump to content
Search Community

setOrigin()

mscharp test
Moderator Tag

Recommended Posts

I have a project that I am working on in which I've made a couple tiny modifications to the TransformManager, and I've run into a bit of a problem. First let me explain the situation.

 

I have Sprite A, Sprite, B, and Sprite C.

 

Sprite C is my TransformItem; its parent is Sprite B. Sprite B's parent is Sprite A. So the Heirarchy looks like A->B->C.

 

TransformManager normally puts the lines and handles (_dummyBox_mc/_selection_mc) in the TransformItem's parent, in this case B.

 

However, in my project, Sprite B is masked which masks the handles and lines as well, so I modified the TransformManager to put the lines/handles in sprite A. This works fine without any problems until...

 

Sprite B can be dragged around inside of Sprite A. When Sprite B is dragged, the lines/handles no longer match up to where the Sprite C is on stage. Obviously this is because the x/y value for Sprite C hasn't changed. So, somehow I need to offset the handles/lines x/y values based on how far Sprite B has moved. I have that value in the TransformManager class, and that is where I am getting stuck.

 

I can successfully get the lines/handles to render in the correct position and can drag around Sprite C successfully. However, as soon as I try to scale Sprite C, the lines/handles position gets changed and no longer works correctly. Deselecting then reselecting will restore them to the correct spot.

 

I'm sure the modification needs to happen in setOrigin() or possibly setScaleOrigin() but I've been tinkering around with the values all day and still haven't been able to get it to work 100% correct.

 

I'd really appreciate any help possible. If the situation isn't clear, let me know and I will try to elaborate further.

 

Thanks.

Link to comment
Share on other sites

Yeah, it's a lot trickier than it may seem at first, especially when accommodating multiple selections and display list hierarchies that can involve many transform matrices. I'm sorry, but this isn't the kind of thing that's supported (you're customizing the code inside TransformManager and using it in a way that's outside its stated functionality). If you need consulting services, feel free to send me a PM or e-mail (warning: my schedule is booked for quite a while so I can't promise I'd be able to make the customizations you're asking for within your project's timeline but we can chat). Frankly, it may be easier for you to just build your mask inside Sprite B instead of Sprite A. I'm not sure what ramifications that has elsewhere in your project, but it sure seems like a cleaner solution here.

Link to comment
Share on other sites

Well thats quite unfortunate...

 

I guess I will have to try to hack something together to get this to work. Too far invested in the project to find another solution now.

 

On a separate note, where/how can I download updates of the transform class? I currently have v1.87 and want to upgrade it to the latest.

 

Thanks

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