Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom properties #153

Open
CrazyFlasher opened this issue Sep 1, 2016 · 8 comments
Open

Custom properties #153

CrazyFlasher opened this issue Sep 1, 2016 · 8 comments

Comments

@CrazyFlasher
Copy link

Is it possible to add some plain Object to layer in fla, that will contain some custom properties?
For example to manually build TextField's

@mathieuanthoine
Copy link

+1

@CrazyFlasher
Copy link
Author

CrazyFlasher commented Oct 3, 2016

Currently I use layer name and parse it. Something like this: @tf:tf:#20#0xD4BEA9#Bitter But that's not very comfortable.

@tconkling
Copy link
Owner

I'm open to this idea - how are you thinking the layer properties would be populated at design time?

@mathieuanthoine
Copy link

  1. For symbols that we want to get custom Data, change the symbols inheritance by a custom class instead of MovieClip or Sprite that implements CustomFlumpData
  2. CustomFlumpData:
    public interface CustomFlumpData {
    public function customData () : Object;
    }
  3. In the Exporter:
    save the customdData object in the description JSon
  4. In the Runtime:
    add a getCustomData method on the FlumpMovie or FlumpSprite that give access to the data.
    It could be awesome to improve Flump !

@CrazyFlasher
Copy link
Author

CrazyFlasher commented Oct 4, 2016

Well, may be the easiest way (not sure, that it is a clean way) would be to fetch object from first frame in layer timeline. Call it, for exapmple customData.
var customData:Object = { myProp:"Hello" };
Exporter will fetch all properties with Object (or just object with customData name?) type and make them available at runtime.

@mathieuanthoine
Copy link

May be the most elegant way could be to use persistent data that are stored in the Xfl description files.
var elem = fl.getDocumentDOM().getTimeline().layers[0].frames[0].elements[0].etPersistentData( "myAlign", "string", "left" );

And in DOMDocument.xml:

<elements> <DOMSymbolInstance libraryItemName="Bob"> <matrix> <Matrix tx="197.45" ty="159.55"/> </matrix> <transformationPoint> <Point/> </transformationPoint> <persistentData> <PD n="myAlign" v="left"/> </persistentData> </DOMSymbolInstance> </elements>

Obviously it would need a custom panel to manage that easily.

@mathieuanthoine
Copy link

I've just submit a PR for custom data support : #157
I hope you'll find it interesting

@jackwlee01
Copy link

This would be an extremely useful feature and would fill a lot of gaps currently in the tool. My company builds games with very heavy UI requirements. I would like to utilise Flump for building UI components, and a feature like this would open up many potential use cases for the tool.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants