1

In flex created a SWC file. It has a Actionscript folder which contains the actionscript files. And then created a desktop project in which I want to invoke a actionscript file from SWC.

In normal way we can call the external source file like this

The question is "How can I give a source path or call a external actionscript file from SWC"?

Is it possible to call plain Actionscript and assets(image folder) file path from SWC to new desktop applications after include the lib file into that project?

9
  • include somepackageinswc.someclass; doesn't work? Commented Jun 13, 2013 at 7:27
  • @ Cherniv: no it doesn't work. Commented Jun 13, 2013 at 9:01
  • so first check if there are packages in swc Commented Jun 13, 2013 at 9:07
  • yeah checked.. Am able to import the packages from swc to desktop app. Commented Jun 13, 2013 at 9:20
  • if you work with FlashDevelop so check its "Add to library" checkbox Commented Jun 13, 2013 at 9:21

1 Answer 1

1
  1. First Create Actionscript class in Library project.
  2. Within a class create a instance of class statically, to access it from outside from the class.

     public class ImagesClass
     {
       private static var iconClass: ImagesClass
    
       public static function getInstance() : ImagesClass
       {
          if ( iconClass== null )
            iconClass= new ImagesClass();
         return iconClass;
       }
       [Bindable]
       [Embed(source="/assets/player_play.png")]
       public var PlayPause_Play:Class;
    
       public function ImagesClass()
       {
       }
       public function displayAlert()
       {
            Alert.show("Function Called","Info");
       }
      }
    
  3. You can call this class from your web/desktop application. (eg):in main.mxml

    <s:Button id="btnLocalVideo" icon="{ImagesClass.getInstance().PlayPause_Pla}" width="100%" height="100%" click="ImagesClass.getInstance().displayAlert()"/>

like that you can access library project actionscript function/variables. and also icons.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.