Re: [Flashcoders] Using assets from external SWF

2006-09-02 Thread Marcelo de Moraes Serpa

Hi Tony,

There are some posts by me on the flashdevelop.org forums:

http://www.flashdevelop.org/community/viewtopic.php?t=511

This should get you started :)

The sharepoint trick was originally published on FlashKit, I don't remember
the name or the link though, sorry. Try a search there.

Good luck,

Marcelo.

On 8/28/06, Anthony Lee [EMAIL PROTECTED] wrote:


Marcelo de Moraes Serpa wrote:
 No you can´t unless it´s a RSL and you're using the sharepoint trick
 (if you
 don´t know what it is just do a quick search on google about rsl and
 sharepoint).
Hi Marcelo,

I did that and was not able to turn it up.

Do you have a link to anything on the 'sharepoint' trick.

Thanks,
Tony
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


Re: [Flashcoders] Using assets from external SWF

2006-08-29 Thread Anthony Lee

Marcelo de Moraes Serpa wrote:
No you can´t unless it´s a RSL and you're using the sharepoint trick 
(if you

don´t know what it is just do a quick search on google about rsl and
sharepoint). 

Hi Marcelo,

I did that and was not able to turn it up.

Do you have a link to anything on the 'sharepoint' trick.

Thanks,
Tony
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


Re: [Flashcoders] Using assets from external SWF

2006-08-22 Thread August Gresens

I was told this was possible in AS2, but it doesn't seem to work.

I was under the impression that after loading an external clip via LoadMove,
the current movie had access to the library of the externally loaded clip
(so that clips in that libarary could be attached via attachMovie).

Is this true or no?

Thanks,

August

On 8/21/06, Samúel Jónasson [EMAIL PROTECTED] wrote:


Yes this is easy in Flex 2.

And it's not just the assets that you can use.  You can use anything in
the loaded swf as if it was in the main movie.

Sammi


Marcelo de Moraes Serpa wrote:
 Hmmm... it seems that AVM2 has solved the classic problem we had with
 Flash
 that forced us to use RSL to do this kind of thing? I mean, we
 couldn´t just
 load a swf and use it´s assets on the parent context and vice-versa...
 is it
 possible with flex 2?

 Marcelo.

 On 8/21/06, Samúel Jónasson [EMAIL PROTECTED] wrote:

 Solved it.

 Actually I was complicating things when trying to use the samples in
 other articles.  Do this if you are interested in checking:

 - Create a skin.swf
 - Create one symbol and export it as Button_up
 - Publish to build the swf.
 - Use the following to include the skin at runtime.

 package {

 import flash.display.*;
 import flash.errors.*;
 import flash.events.*;
 import flash.system.*;
 import flash.net.*;


 public class SkinTest extends Sprite{

 private var theSkin:Loader;

 public function SkinTest(){
 loadSkin();
 }

 private function loadSkin():void{

 theSkin = new Loader();
 theSkin.contentLoaderInfo.addEventListener(Event.COMPLETE,
 skinLoadedHandler);
 theSkin.load(new URLRequest(skin.swf));

 }

 private function skinLoadedHandler(event:Event):void{

 // try to use symbol from skin.swf
 var asset:Sprite = getSkinAsset(Button_up);
 addChild(asset);

 }

 private function getSkinAsset(skinAsset:String){

 var assetClass:Class =
 theSkin.contentLoaderInfo.applicationDomain.getDefinition(skinAsset) as
 Class;
 var asset:Object = new assetClass();

 return asset;

 }

 }

 }


 I hope this helps someone.

 Sammi


 Samúel Jónasson wrote:
  His.
 
  thank you for your response.
 
  I had read this article as well but didn't find the solution to my
  problem.  It is really important for me not to have to compile my app
  when the skin changes - so they need to load at runtime.  So if I
have
  two files:
 
  - assets.swf
  - app.swf
 
  ...the symbols in assets.swf have a auto generated classes.  So a
  Star symbol would have a Star class generated on export.
  Then app.swf loads the assets.swf at runtime of with some magic ( as
  explained in some of the articles ) has access to the classes in
  assets.swf and can instantiate them.
 
  So if i need a star:
 
  var myStar:Star = new Star();
  addChild(myStar);
 
  ...and I get the symbol created in assets.swf.
 
 
  Matthew Ganz wrote:
  hi.
 
  i don't have the answer to your question but i did see this post on
  keith peters' blog this morning that may help you out:
 
  http://www.bit-101.com/blog/?p=853
  - Original Message - From: Samúel Jónasson
  [EMAIL PROTECTED]
  To: flashcoders@chattyfig.figleaf.com
  Sent: Monday, August 21, 2006 10:31 AM
  Subject: [Flashcoders] Using assets from external SWF
 
 
  Hi everyone,
 
  I am trying to find out how to use external SWF as a library of
  assets that I can instantiate in my as3 projects. I have gone
  through several articles that almost explain this.  One in
  particular is Loading Flex Skins at Runtime at
  http://blogs.adobe.com/kiwi/2006/07/
 
  Basically I want to have my assets (skins, icons etc) in this
  external swf (assets.swf ) that I create in Flash 9.  Then load
that
  file with the Loader class at runtime in an as3 project and
  instantiate the classes of the assets to add them to the stage,
  once or more.
 
  Does anyone have a working sample of this?
 
 
  ___
  Flashcoders@chattyfig.figleaf.com
  To change your subscription options or search the archive:
  http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
 
  Brought to you by Fig Leaf Software
  Premier Authorized Adobe Consulting and Training
  http://www.figleaf.com
  http://training.figleaf.com
 
  ___
  Flashcoders@chattyfig.figleaf.com
  To change your subscription options or search the archive:
  http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
 
  Brought to you by Fig Leaf Software
  Premier Authorized Adobe Consulting and Training
  http://www.figleaf.com
  http://training.figleaf.com
 
 
  ___
  Flashcoders@chattyfig.figleaf.com
  To change your subscription options or search the archive:
  http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Re: [Flashcoders] Using assets from external SWF

2006-08-22 Thread Marcelo de Moraes Serpa

No you can´t unless it´s a RSL and you're using the sharepoint trick (if you
don´t know what it is just do a quick search on google about rsl and
sharepoint). It was one of the things that I found confusing and hard to
understand when I started learning the flash platform. Seems they have fixed
it with a new improved and more common-sense based architecture on AVM2 :)

Marcelo.

On 8/22/06, August Gresens [EMAIL PROTECTED] wrote:


I was told this was possible in AS2, but it doesn't seem to work.

I was under the impression that after loading an external clip via
LoadMove,
the current movie had access to the library of the externally loaded clip
(so that clips in that libarary could be attached via attachMovie).

Is this true or no?

Thanks,

August

On 8/21/06, Samúel Jónasson [EMAIL PROTECTED] wrote:

 Yes this is easy in Flex 2.

 And it's not just the assets that you can use.  You can use anything in
 the loaded swf as if it was in the main movie.

 Sammi


 Marcelo de Moraes Serpa wrote:
  Hmmm... it seems that AVM2 has solved the classic problem we had with
  Flash
  that forced us to use RSL to do this kind of thing? I mean, we
  couldn´t just
  load a swf and use it´s assets on the parent context and vice-versa...
  is it
  possible with flex 2?
 
  Marcelo.
 
  On 8/21/06, Samúel Jónasson [EMAIL PROTECTED] wrote:
 
  Solved it.
 
  Actually I was complicating things when trying to use the samples in
  other articles.  Do this if you are interested in checking:
 
  - Create a skin.swf
  - Create one symbol and export it as Button_up
  - Publish to build the swf.
  - Use the following to include the skin at runtime.
 
  package {
 
  import flash.display.*;
  import flash.errors.*;
  import flash.events.*;
  import flash.system.*;
  import flash.net.*;
 
 
  public class SkinTest extends Sprite{
 
  private var theSkin:Loader;
 
  public function SkinTest(){
  loadSkin();
  }
 
  private function loadSkin():void{
 
  theSkin = new Loader();
  theSkin.contentLoaderInfo.addEventListener(Event.COMPLETE
,
  skinLoadedHandler);
  theSkin.load(new URLRequest(skin.swf));
 
  }
 
  private function skinLoadedHandler(event:Event):void{
 
  // try to use symbol from skin.swf
  var asset:Sprite = getSkinAsset(Button_up);
  addChild(asset);
 
  }
 
  private function getSkinAsset(skinAsset:String){
 
  var assetClass:Class =
  theSkin.contentLoaderInfo.applicationDomain.getDefinition(skinAsset)
as
  Class;
  var asset:Object = new assetClass();
 
  return asset;
 
  }
 
  }
 
  }
 
 
  I hope this helps someone.
 
  Sammi
 
 
  Samúel Jónasson wrote:
   His.
  
   thank you for your response.
  
   I had read this article as well but didn't find the solution to my
   problem.  It is really important for me not to have to compile my
app
   when the skin changes - so they need to load at runtime.  So if I
 have
   two files:
  
   - assets.swf
   - app.swf
  
   ...the symbols in assets.swf have a auto generated classes.  So a
   Star symbol would have a Star class generated on export.
   Then app.swf loads the assets.swf at runtime of with some magic (
as
   explained in some of the articles ) has access to the classes in
   assets.swf and can instantiate them.
  
   So if i need a star:
  
   var myStar:Star = new Star();
   addChild(myStar);
  
   ...and I get the symbol created in assets.swf.
  
  
   Matthew Ganz wrote:
   hi.
  
   i don't have the answer to your question but i did see this post
on
   keith peters' blog this morning that may help you out:
  
   http://www.bit-101.com/blog/?p=853
   - Original Message - From: Samúel Jónasson
   [EMAIL PROTECTED]
   To: flashcoders@chattyfig.figleaf.com
   Sent: Monday, August 21, 2006 10:31 AM
   Subject: [Flashcoders] Using assets from external SWF
  
  
   Hi everyone,
  
   I am trying to find out how to use external SWF as a library of
   assets that I can instantiate in my as3 projects. I have gone
   through several articles that almost explain this.  One in
   particular is Loading Flex Skins at Runtime at
   http://blogs.adobe.com/kiwi/2006/07/
  
   Basically I want to have my assets (skins, icons etc) in this
   external swf (assets.swf ) that I create in Flash 9.  Then load
 that
   file with the Loader class at runtime in an as3 project and
   instantiate the classes of the assets to add them to the stage,
   once or more.
  
   Does anyone have a working sample of this?
  
  
   ___
   Flashcoders@chattyfig.figleaf.com
   To change your subscription options or search the archive:
   http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
  
   Brought to you by Fig Leaf Software
   Premier Authorized Adobe Consulting and Training
   http://www.figleaf.com
   http

[Flashcoders] Using assets from external SWF

2006-08-21 Thread Samúel Jónasson

Hi everyone,

I am trying to find out how to use external SWF as a library of assets 
that I can instantiate in my as3 projects. I have gone through several 
articles that almost explain this.  One in particular is Loading Flex 
Skins at Runtime at http://blogs.adobe.com/kiwi/2006/07/


Basically I want to have my assets (skins, icons etc) in this external 
swf (assets.swf ) that I create in Flash 9.  Then load that file with 
the Loader class at runtime in an as3 project and instantiate the 
classes of the assets to add them to the stage, once or more.


Does anyone have a working sample of this?


___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


Re: [Flashcoders] Using assets from external SWF

2006-08-21 Thread Matthew Ganz

hi.

i don't have the answer to your question but i did see this post on keith 
peters' blog this morning that may help you out:


http://www.bit-101.com/blog/?p=853
- Original Message - 
From: Samúel Jónasson [EMAIL PROTECTED]

To: flashcoders@chattyfig.figleaf.com
Sent: Monday, August 21, 2006 10:31 AM
Subject: [Flashcoders] Using assets from external SWF



Hi everyone,

I am trying to find out how to use external SWF as a library of assets 
that I can instantiate in my as3 projects. I have gone through several 
articles that almost explain this.  One in particular is Loading Flex 
Skins at Runtime at http://blogs.adobe.com/kiwi/2006/07/


Basically I want to have my assets (skins, icons etc) in this external swf 
(assets.swf ) that I create in Flash 9.  Then load that file with the 
Loader class at runtime in an as3 project and instantiate the classes of 
the assets to add them to the stage, once or more.


Does anyone have a working sample of this?


___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com 


___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


Re: [Flashcoders] Using assets from external SWF

2006-08-21 Thread Samúel Jónasson

His.

thank you for your response.

I had read this article as well but didn't find the solution to my 
problem.  It is really important for me not to have to compile my app 
when the skin changes - so they need to load at runtime.  So if I have 
two files:


- assets.swf
- app.swf

...the symbols in assets.swf have a auto generated classes.  So a 
Star symbol would have a Star class generated on export.
Then app.swf loads the assets.swf at runtime of with some magic ( as 
explained in some of the articles ) has access to the classes in 
assets.swf and can instantiate them.


So if i need a star:

var myStar:Star = new Star();
addChild(myStar);

...and I get the symbol created in assets.swf.


Matthew Ganz wrote:

hi.

i don't have the answer to your question but i did see this post on 
keith peters' blog this morning that may help you out:


http://www.bit-101.com/blog/?p=853
- Original Message - From: Samúel Jónasson 
[EMAIL PROTECTED]

To: flashcoders@chattyfig.figleaf.com
Sent: Monday, August 21, 2006 10:31 AM
Subject: [Flashcoders] Using assets from external SWF



Hi everyone,

I am trying to find out how to use external SWF as a library of 
assets that I can instantiate in my as3 projects. I have gone through 
several articles that almost explain this.  One in particular is 
Loading Flex Skins at Runtime at http://blogs.adobe.com/kiwi/2006/07/


Basically I want to have my assets (skins, icons etc) in this 
external swf (assets.swf ) that I create in Flash 9.  Then load that 
file with the Loader class at runtime in an as3 project and 
instantiate the classes of the assets to add them to the stage, 
once or more.


Does anyone have a working sample of this?


___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com 


___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com



___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


Re: [Flashcoders] Using assets from external SWF

2006-08-21 Thread Samúel Jónasson

Solved it.

Actually I was complicating things when trying to use the samples in 
other articles.  Do this if you are interested in checking:


- Create a skin.swf
- Create one symbol and export it as Button_up
- Publish to build the swf.
- Use the following to include the skin at runtime.

package {
  
   import flash.display.*;

   import flash.errors.*;
   import flash.events.*;
   import flash.system.*;
   import flash.net.*;


   public class SkinTest extends Sprite{
  
   private var theSkin:Loader;
  
   public function SkinTest(){   
   loadSkin();   
   }   
  
   private function loadSkin():void{
  
   theSkin = new Loader();
   theSkin.contentLoaderInfo.addEventListener(Event.COMPLETE, 
skinLoadedHandler);

   theSkin.load(new URLRequest(skin.swf));

   }   
  
   private function skinLoadedHandler(event:Event):void{


   // try to use symbol from skin.swf
   var asset:Sprite = getSkinAsset(Button_up);
   addChild(asset);
  
   }   
  
   private function getSkinAsset(skinAsset:String){
  
   var assetClass:Class = 
theSkin.contentLoaderInfo.applicationDomain.getDefinition(skinAsset) as 
Class;

   var asset:Object = new assetClass();
  
   return asset;
  
   }
  
   }
  
}



I hope this helps someone.

Sammi


Samúel Jónasson wrote:

His.

thank you for your response.

I had read this article as well but didn't find the solution to my 
problem.  It is really important for me not to have to compile my app 
when the skin changes - so they need to load at runtime.  So if I have 
two files:


- assets.swf
- app.swf

...the symbols in assets.swf have a auto generated classes.  So a 
Star symbol would have a Star class generated on export.
Then app.swf loads the assets.swf at runtime of with some magic ( as 
explained in some of the articles ) has access to the classes in 
assets.swf and can instantiate them.


So if i need a star:

var myStar:Star = new Star();
addChild(myStar);

...and I get the symbol created in assets.swf.


Matthew Ganz wrote:

hi.

i don't have the answer to your question but i did see this post on 
keith peters' blog this morning that may help you out:


http://www.bit-101.com/blog/?p=853
- Original Message - From: Samúel Jónasson 
[EMAIL PROTECTED]

To: flashcoders@chattyfig.figleaf.com
Sent: Monday, August 21, 2006 10:31 AM
Subject: [Flashcoders] Using assets from external SWF



Hi everyone,

I am trying to find out how to use external SWF as a library of 
assets that I can instantiate in my as3 projects. I have gone 
through several articles that almost explain this.  One in 
particular is Loading Flex Skins at Runtime at 
http://blogs.adobe.com/kiwi/2006/07/


Basically I want to have my assets (skins, icons etc) in this 
external swf (assets.swf ) that I create in Flash 9.  Then load that 
file with the Loader class at runtime in an as3 project and 
instantiate the classes of the assets to add them to the stage, 
once or more.


Does anyone have a working sample of this?


___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com 


___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com



___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com



___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


Re: [Flashcoders] Using assets from external SWF

2006-08-21 Thread Marcelo de Moraes Serpa

Hmmm... it seems that AVM2 has solved the classic problem we had with Flash
that forced us to use RSL to do this kind of thing? I mean, we couldn´t just
load a swf and use it´s assets on the parent context and vice-versa... is it
possible with flex 2?

Marcelo.

On 8/21/06, Samúel Jónasson [EMAIL PROTECTED] wrote:


Solved it.

Actually I was complicating things when trying to use the samples in
other articles.  Do this if you are interested in checking:

- Create a skin.swf
- Create one symbol and export it as Button_up
- Publish to build the swf.
- Use the following to include the skin at runtime.

package {

import flash.display.*;
import flash.errors.*;
import flash.events.*;
import flash.system.*;
import flash.net.*;


public class SkinTest extends Sprite{

private var theSkin:Loader;

public function SkinTest(){
loadSkin();
}

private function loadSkin():void{

theSkin = new Loader();
theSkin.contentLoaderInfo.addEventListener(Event.COMPLETE,
skinLoadedHandler);
theSkin.load(new URLRequest(skin.swf));

}

private function skinLoadedHandler(event:Event):void{

// try to use symbol from skin.swf
var asset:Sprite = getSkinAsset(Button_up);
addChild(asset);

}

private function getSkinAsset(skinAsset:String){

var assetClass:Class =
theSkin.contentLoaderInfo.applicationDomain.getDefinition(skinAsset) as
Class;
var asset:Object = new assetClass();

return asset;

}

}

}


I hope this helps someone.

Sammi


Samúel Jónasson wrote:
 His.

 thank you for your response.

 I had read this article as well but didn't find the solution to my
 problem.  It is really important for me not to have to compile my app
 when the skin changes - so they need to load at runtime.  So if I have
 two files:

 - assets.swf
 - app.swf

 ...the symbols in assets.swf have a auto generated classes.  So a
 Star symbol would have a Star class generated on export.
 Then app.swf loads the assets.swf at runtime of with some magic ( as
 explained in some of the articles ) has access to the classes in
 assets.swf and can instantiate them.

 So if i need a star:

 var myStar:Star = new Star();
 addChild(myStar);

 ...and I get the symbol created in assets.swf.


 Matthew Ganz wrote:
 hi.

 i don't have the answer to your question but i did see this post on
 keith peters' blog this morning that may help you out:

 http://www.bit-101.com/blog/?p=853
 - Original Message - From: Samúel Jónasson
 [EMAIL PROTECTED]
 To: flashcoders@chattyfig.figleaf.com
 Sent: Monday, August 21, 2006 10:31 AM
 Subject: [Flashcoders] Using assets from external SWF


 Hi everyone,

 I am trying to find out how to use external SWF as a library of
 assets that I can instantiate in my as3 projects. I have gone
 through several articles that almost explain this.  One in
 particular is Loading Flex Skins at Runtime at
 http://blogs.adobe.com/kiwi/2006/07/

 Basically I want to have my assets (skins, icons etc) in this
 external swf (assets.swf ) that I create in Flash 9.  Then load that
 file with the Loader class at runtime in an as3 project and
 instantiate the classes of the assets to add them to the stage,
 once or more.

 Does anyone have a working sample of this?


 ___
 Flashcoders@chattyfig.figleaf.com
 To change your subscription options or search the archive:
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

 Brought to you by Fig Leaf Software
 Premier Authorized Adobe Consulting and Training
 http://www.figleaf.com
 http://training.figleaf.com

 ___
 Flashcoders@chattyfig.figleaf.com
 To change your subscription options or search the archive:
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

 Brought to you by Fig Leaf Software
 Premier Authorized Adobe Consulting and Training
 http://www.figleaf.com
 http://training.figleaf.com


 ___
 Flashcoders@chattyfig.figleaf.com
 To change your subscription options or search the archive:
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

 Brought to you by Fig Leaf Software
 Premier Authorized Adobe Consulting and Training
 http://www.figleaf.com
 http://training.figleaf.com


___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf

Re: [Flashcoders] Using assets from external SWF

2006-08-21 Thread Samúel Jónasson

Yes this is easy in Flex 2.

And it's not just the assets that you can use.  You can use anything in 
the loaded swf as if it was in the main movie.


Sammi


Marcelo de Moraes Serpa wrote:
Hmmm... it seems that AVM2 has solved the classic problem we had with 
Flash
that forced us to use RSL to do this kind of thing? I mean, we 
couldn´t just
load a swf and use it´s assets on the parent context and vice-versa... 
is it

possible with flex 2?

Marcelo.

On 8/21/06, Samúel Jónasson [EMAIL PROTECTED] wrote:


Solved it.

Actually I was complicating things when trying to use the samples in
other articles.  Do this if you are interested in checking:

- Create a skin.swf
- Create one symbol and export it as Button_up
- Publish to build the swf.
- Use the following to include the skin at runtime.

package {

import flash.display.*;
import flash.errors.*;
import flash.events.*;
import flash.system.*;
import flash.net.*;


public class SkinTest extends Sprite{

private var theSkin:Loader;

public function SkinTest(){
loadSkin();
}

private function loadSkin():void{

theSkin = new Loader();
theSkin.contentLoaderInfo.addEventListener(Event.COMPLETE,
skinLoadedHandler);
theSkin.load(new URLRequest(skin.swf));

}

private function skinLoadedHandler(event:Event):void{

// try to use symbol from skin.swf
var asset:Sprite = getSkinAsset(Button_up);
addChild(asset);

}

private function getSkinAsset(skinAsset:String){

var assetClass:Class =
theSkin.contentLoaderInfo.applicationDomain.getDefinition(skinAsset) as
Class;
var asset:Object = new assetClass();

return asset;

}

}

}


I hope this helps someone.

Sammi


Samúel Jónasson wrote:
 His.

 thank you for your response.

 I had read this article as well but didn't find the solution to my
 problem.  It is really important for me not to have to compile my app
 when the skin changes - so they need to load at runtime.  So if I have
 two files:

 - assets.swf
 - app.swf

 ...the symbols in assets.swf have a auto generated classes.  So a
 Star symbol would have a Star class generated on export.
 Then app.swf loads the assets.swf at runtime of with some magic ( as
 explained in some of the articles ) has access to the classes in
 assets.swf and can instantiate them.

 So if i need a star:

 var myStar:Star = new Star();
 addChild(myStar);

 ...and I get the symbol created in assets.swf.


 Matthew Ganz wrote:
 hi.

 i don't have the answer to your question but i did see this post on
 keith peters' blog this morning that may help you out:

 http://www.bit-101.com/blog/?p=853
 - Original Message - From: Samúel Jónasson
 [EMAIL PROTECTED]
 To: flashcoders@chattyfig.figleaf.com
 Sent: Monday, August 21, 2006 10:31 AM
 Subject: [Flashcoders] Using assets from external SWF


 Hi everyone,

 I am trying to find out how to use external SWF as a library of
 assets that I can instantiate in my as3 projects. I have gone
 through several articles that almost explain this.  One in
 particular is Loading Flex Skins at Runtime at
 http://blogs.adobe.com/kiwi/2006/07/

 Basically I want to have my assets (skins, icons etc) in this
 external swf (assets.swf ) that I create in Flash 9.  Then load that
 file with the Loader class at runtime in an as3 project and
 instantiate the classes of the assets to add them to the stage,
 once or more.

 Does anyone have a working sample of this?


 ___
 Flashcoders@chattyfig.figleaf.com
 To change your subscription options or search the archive:
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

 Brought to you by Fig Leaf Software
 Premier Authorized Adobe Consulting and Training
 http://www.figleaf.com
 http://training.figleaf.com

 ___
 Flashcoders@chattyfig.figleaf.com
 To change your subscription options or search the archive:
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

 Brought to you by Fig Leaf Software
 Premier Authorized Adobe Consulting and Training
 http://www.figleaf.com
 http://training.figleaf.com


 ___
 Flashcoders@chattyfig.figleaf.com
 To change your subscription options or search the archive:
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

 Brought to you by Fig Leaf Software
 Premier Authorized Adobe Consulting and Training
 http://www.figleaf.com
 http://training.figleaf.com


___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com