Comments (10)
Yes.
LWF allows you to instantiate symbols in library during runtime with Movie.AttachMovie() method.
Overview
// instantiate symbol named "symbol_linkage_name".
// New instance's name is "name_of_new_instance", and the instance is attached to rootMovie.
lwf.rootMovie.AttachMovie("symbol_linkage_name", "name_of_new_instance");
Steps
- Open your.fla file.
- In Library tab, make sure that your symbol's "AS Linkage" has proper name like "symbol_linkage_name".
- Publish it to swf file.
- Convert from swf to lwf file.
- Open "your_swf_file_name.linkages" text file in .lwfdata folder. The *.linkage text file will contains linkage name that specified in step 2 like "symbol_linkage_name : 0".
- If not, the linkage name is not published properly. Go to step 2
- It's ready to instantiate it call following after lwf's initialization. The "symbol_linkage_name" would be added to the stage.
lwf.rootMovie.AttachMovie("symbol_linkage_name", "name_of_new_instance");
from lwf.
thank you very much..i'll try it.
from lwf.
tried four times,and not success。
i want to do it in unity.so...can you tell me in details of process.
from lwf.
O.K. I've uploaded full-set example to demonstrate create symbol from library.
Source
- Flash : https://github.com/gree/lwf-demo/blob/master/flash/attach_movies_from_library.fla
- Unity Project: https://github.com/gree/lwf-demo/tree/master/unity/attach_movies_from_library
Build
- Unity Web Player : http://gree.github.io/lwf-demo/unity/attach_movies_from_library/attach_movies_from_library.html
- Click "Attach movie form..." create new symbol from library.
This example will solve your issue.
If you have any questions on this example, please let me know,
from lwf.
thank you ,the example is worked but in my case ,png is been texture atlas,it not display.....What shall i do?
from lwf.
O.K. I'd like to take a look it. Please wait a moment.
from lwf.
ok.thx!
from lwf.
Here we go:)
Source
- Flash : https://github.com/gree/lwf-demo/blob/master/flash/sprite_atlas.fla
- Unity : https://github.com/gree/lwf-demo/tree/master/unity/attach_movies_from_library_sprite
- Symbol's linkage name is "lightening"
Build
Step to publish
- Open sprite_atlas.fla.
- Publish with Commands/LWF_Publish. bitmaps are expoerted to sprite_atlas.bitmap folder.
- Create texture sheet with Texture Packer like /Applications/TexturePacker.app/Contents/MacOS/TexturePacker --opt RGBA4444 --scale 1.0 --format json --data sprite_atlas.json --sheet "sprite_atlas_texture.png" sprite_atlas.bitmap/*
- Convert swf to lwf with texture sheet information like : swf2lwf sprite_atlas.swf sprite_atlas.json
- Open Unity project, and import these
- Call lwf.rootMovie.AttachMovie("lightening").
from lwf.
thank you so much!it worked...and more question. Is there anyway to change the lwf animation by symbol name?
For example,i need symbol name "wait" work 3 seconds for loop,More than 3 seconds change to symbol "attack" and not want loop, just one time.
from lwf.
I'm happy to hear that this issue has been resolved.
Can you please create another issue for symbol question?
from lwf.
Related Issues (20)
- OnEnterFrame not working on low FPS flashes? HOT 2
- Non-movable buttons HOT 5
- Text Filters in Unity HOT 1
- Getting LWF.Bounds of a LWF.Movie immediately HOT 1
- Updating the flash with a delta time of 0 still calls OnEnterFrame
- Disabled buttons still blocking mouse events
- TextProperty in Unity
- Changing the ColorTransform of a LWF.Movie HOT 1
- Blending modes
- SetText() not always rendering new value HOT 2
- fscommand ignored unless frame entered "naturally" HOT 1
- I got a data file(.lwf) used this tool(swf2lwf.rb).But I cannot use in the unity.
- Warnings
- No longer rendering timeline HOT 3
- Text fields are not respecting the alpha of the MovieClip that contains it
- flash-in-unity.net
- can you support spritekit?
- Shapes Support
- Locate error cause easily when converting swf files
- Bad link HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lwf.