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?

有帮助吗?

解决方案

  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.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top