Jump to content
GreenSock

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

Embedded font editable text field transforming

Recommended Posts

Hi

 

I load fonts dynamically (using LoaderMax !), and all the user to creat text fields that can be manipulated using the TransformManager.

Once a field is created, the user should be able to edit it (up to here, all is good)

 

Now, here is where I am almost certainly asking too much of TransformManager

 

Ideally I would like to

1 - Have the central handle so the user can drag easily

2 - Have the text become bigger when the TramsformItem is scaled

3 - Be able to delete using backspace

 

I imagine that 3 is undoable since there is a confusion between deleting a letter and deleting the item...

But 1 and 2 seem doable, I just can't figure out how !?

 

Thnaks

 

Jason

Link to comment
Share on other sites

Cool use of LoaderMax to load fonts! Thanks for sharing.

 

As for altering the scaleMode, TransformManager automatically sets it to SCALE_WIDTH_AND_HEIGHT if the object is a TextField (because that's almost always the desired behavior), but you could set it manually like:

 

var item:TransformItem = myManager.addItem(myTextField);
item.scaleMode = TransformManager.SCALE_NORMAL;

 

or just wrap your TextFields in Sprites. Have you tried that?

Link to comment
Share on other sites

Hi Jack

 

I blush like a schoolgirl !

I spent a whole day getting this far with fonts and text...

The connections var in LoaderMAx is great - setting it to 1 means that the fonts load onde by one in the correct order... and don't hog the bandwidth (Elsewhere in the app I am loading images using LoaderMax).

So... cool

 

Now I have the scale set correctly (soooooo simple when you know how !),

I also see that the problem with the center handle is due to my code, not yours :

manager.hideCenterHandle = true;

Is there a way to set it on an item-by-item basis ? Obviously, I could create two Transform Managers, but that is untidy.

 

Next question is :

Is there an easy way to ad a delete handle to one corner of the items ?

The only way I can see it to get the top right hand coordinates and manually add it on each update...

 

Thanks

 

Jason

Link to comment
Share on other sites

PS : I also spent a few hours trying to get the name of each font in the combo box written in the font itself

I only managed to get the entire list in any one font, not a different font per item...

Any snazzy :ugeek: out there can help ?

Link to comment
Share on other sites

Next question is :

Is there an easy way to ad a delete handle to one corner of the items ?

 

Depends on how you define "easy" :) No, there isn't a simple way to add your own custom buttons/handles that are stuck to a certain edge/corner of the selection. You'd need to edit the source code. One idea would be to map the coordinates to the spot in the _dummyBox and use localToGlobal() and globalToLocal() to figure out where that point is in your parent container so that you can place your object there. Or mess with the creation of the _selection Sprite and its handles. But again, there's not a super simple way to add custom functionality like that.

Link to comment
Share on other sites

I think I'll try to convince the client to go with a trash can !

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