Giter Club home page Giter Club logo

Comments (10)

HiroyukiHaga avatar HiroyukiHaga commented on August 21, 2024

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

  1. Open your.fla file.
  2. In Library tab, make sure that your symbol's "AS Linkage" has proper name like "symbol_linkage_name".
  3. Publish it to swf file.
  4. Convert from swf to lwf file.
  5. 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".
    1. If not, the linkage name is not published properly. Go to step 2
  6. 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.

cy-zhang-yekai avatar cy-zhang-yekai commented on August 21, 2024

thank you very much..i'll try it.

from lwf.

cy-zhang-yekai avatar cy-zhang-yekai commented on August 21, 2024

tried four times,and not success。
i want to do it in unity.so...can you tell me in details of process.

from lwf.

HiroyukiHaga avatar HiroyukiHaga commented on August 21, 2024

O.K. I've uploaded full-set example to demonstrate create symbol from library.

Source

Build

This example will solve your issue.
If you have any questions on this example, please let me know,

from lwf.

cy-zhang-yekai avatar cy-zhang-yekai commented on August 21, 2024

thank you ,the example is worked but in my case ,png is been texture atlas,it not display.....What shall i do?

from lwf.

HiroyukiHaga avatar HiroyukiHaga commented on August 21, 2024

O.K. I'd like to take a look it. Please wait a moment.

from lwf.

cy-zhang-yekai avatar cy-zhang-yekai commented on August 21, 2024

ok.thx!

from lwf.

HiroyukiHaga avatar HiroyukiHaga commented on August 21, 2024

Here we go:)

Source

Build

Step to publish

  1. Open sprite_atlas.fla.
  2. Publish with Commands/LWF_Publish. bitmaps are expoerted to sprite_atlas.bitmap folder.
  3. 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/*
  4. Convert swf to lwf with texture sheet information like : swf2lwf sprite_atlas.swf sprite_atlas.json
  5. Open Unity project, and import these
  6. Call lwf.rootMovie.AttachMovie("lightening").

from lwf.

cy-zhang-yekai avatar cy-zhang-yekai commented on August 21, 2024

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.

HiroyukiHaga avatar HiroyukiHaga commented on August 21, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.