flump
flump copied to clipboard
Custom properties
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
+1
Currently I use layer name and parse it. Something like this: @tf:tf:#20#0xD4BEA9#Bitter
But that's not very comfortable.
I'm open to this idea - how are you thinking the layer properties would be populated at design time?
- 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
- CustomFlumpData: public interface CustomFlumpData { public function customData () : Object; }
- In the Exporter: save the customdData object in the description JSon
- 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 !
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.
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.
I've just submit a PR for custom data support : https://github.com/tconkling/flump/pull/157 I hope you'll find it interesting
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.