RE: [Flashcoders] unexpected result with linked classes in embedded swfs
My understanding is that classes are only imported once and have a single instance in the player - so if .swf A loads in .swf B, and both use Class X, then if you change class X and re-publish only .swf A, you will see the change in both .swf and .swf B. I could be wrong, but that is my understanding of how the player handles custom classes. Jason Merrill Bank of America Global Learning Shared Services Solutions Development Monthly meetings on the Adobe Flash platform for rich media experiences - join the Bank of America Flash Platform Community -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Andrew Sinning Sent: Tuesday, May 19, 2009 9:28 AM To: Flash Coders Subject: [Flashcoders] unexpected result with linked classes in embedded swfs I'm working in AS2. The skin-swf that I am embedding into my main movie contains symbols that are linked to classes. Objects in my main movie make calls to some of the classes that are defined in the skin. In order to get nice code-hinting in Flash Develop and compile-checking, I import these same classes into some of the objects in my main-movie. If I make change to the AS file for a symbol defined in the skin-swf, but ONLY recompile the main-movie and not the skin-swf, I wouldn't expect the changes made to take effect, but they do. Does this make sense to anyone? For example: if I add a new function to a class that is linked to a symbol in the skin-swf, and I call that function from the main-movie. I would expect to have to recompile both the skin-swf and the main-movie. However, what I've found is that I only have to recompile the main-movie. It seems that if the class is imported into the main-movie, then those instructions override the instructions compiled into the skin-swf. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] unexpected result with linked classes in embedded swfs
Hi Andrew If you reference a class in your main movie then that class will be automatically compiled into your main movie. A single reference to the class is enough to include it. There are ways to prevent that from occurring. In AS2 I believe you could create an exclude XML file that lists all the classes that you want to specifically exclude from compiling into your swf. If your list of classes is constantly changing and evolving (new classes added, old classes removed) then exclude XML files were a pain to maintain. If on the other hand all your doing is adding new methods to a class and your list of classes is fairly static then exclude XML files would work. There are specific rules, the name has to be the same name as your FLA file followed by something like _exclude.xml. The rules are listed somewhere in the help files or search on the web for it. The structure of the file is also fairly specific. Back in the day I resorted to writing a small app that would parse through a directory and write the appropriate exclude for all classes within a package or the like. Unfortunately haven't used AS2 in a couple of years now so I can't give you any more hints then that. Sincerely Mark R. Jonkman - Original Message - From: Andrew Sinning and...@learningware.com To: Flash Coders flashcoders@chattyfig.figleaf.com Sent: Tuesday, May 19, 2009 9:27:31 AM GMT -05:00 US/Canada Eastern Subject: [Flashcoders] unexpected result with linked classes in embedded swfs I'm working in AS2. The skin-swf that I am embedding into my main movie contains symbols that are linked to classes. Objects in my main movie make calls to some of the classes that are defined in the skin. In order to get nice code-hinting in Flash Develop and compile-checking, I import these same classes into some of the objects in my main-movie. If I make change to the AS file for a symbol defined in the skin-swf, but ONLY recompile the main-movie and not the skin-swf, I wouldn't expect the changes made to take effect, but they do. Does this make sense to anyone? For example: if I add a new function to a class that is linked to a symbol in the skin-swf, and I call that function from the main-movie. I would expect to have to recompile both the skin-swf and the main-movie. However, what I've found is that I only have to recompile the main-movie. It seems that if the class is imported into the main-movie, then those instructions override the instructions compiled into the skin-swf. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] unexpected result with linked classes in embedded swfs
Guessing that if you run your skin-swf, the classes won't work properly in there until you re-compile. Because main.swf is loaded first by the player, these classes will be declared in there and not overwritten when loaded in (guess that's a security feature). Glen Andrew Sinning wrote: I'm working in AS2. The skin-swf that I am embedding into my main movie contains symbols that are linked to classes. Objects in my main movie make calls to some of the classes that are defined in the skin. In order to get nice code-hinting in Flash Develop and compile-checking, I import these same classes into some of the objects in my main-movie. If I make change to the AS file for a symbol defined in the skin-swf, but ONLY recompile the main-movie and not the skin-swf, I wouldn't expect the changes made to take effect, but they do. Does this make sense to anyone? For example: if I add a new function to a class that is linked to a symbol in the skin-swf, and I call that function from the main-movie. I would expect to have to recompile both the skin-swf and the main-movie. However, what I've found is that I only have to recompile the main-movie. It seems that if the class is imported into the main-movie, then those instructions override the instructions compiled into the skin-swf. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] unexpected result with linked classes in embedded swfs
If your source and linked file are importing the same AS2 class, the first one imported gets put into the global class tables. Flash sees that the class from the imported link is within the same namespace and considers it already in existence. This is not so unexpected behaviour. If you are going to have your class used throughout various linked swfs, then keep it in your main movie and exclude the class from the links swfs when compiling (using an exclude xml file). jord Andrew Sinning wrote: I'm working in AS2. The skin-swf that I am embedding into my main movie contains symbols that are linked to classes. Objects in my main movie make calls to some of the classes that are defined in the skin. In order to get nice code-hinting in Flash Develop and compile-checking, I import these same classes into some of the objects in my main-movie. If I make change to the AS file for a symbol defined in the skin-swf, but ONLY recompile the main-movie and not the skin-swf, I wouldn't expect the changes made to take effect, but they do. Does this make sense to anyone? For example: if I add a new function to a class that is linked to a symbol in the skin-swf, and I call that function from the main-movie. I would expect to have to recompile both the skin-swf and the main-movie. However, what I've found is that I only have to recompile the main-movie. It seems that if the class is imported into the main-movie, then those instructions override the instructions compiled into the skin-swf. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] unexpected result with linked classes in embedded swfs
Jordan, Mark et all advised: If you are going to have your class used throughout various linked swfs, then keep it in your main movie and exclude the class from the links swfs when compiling (using an exclude xml file). Thanks! This is really helpful. It seems so stupid of me to program the skins this way, and having to keep recompiling them (as I thought I had to) was really becoming a pain. My skins take a lot longer to compile than main movie, even though they contain much less AS. Must be the graphics So, in my library in the skin, I will link the symbols to the external AS in the same way, but then I'll use an exclude file to prevent them from actually getting compiled into the swf? Then when the skin-swf gets loaded into the main the symbols will find their classes? ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] unexpected result with linked classes in embedded swfs
You should look into LoaderContext and ApplicationDomain. I just finished battling a similar problem where flash would tell me at runtime. Cannot convert elements.gamescr...@b785a to elements.GameScreen You can control which class flash uses with the loaded class, by specifying it in the LoaderContext when you create the loader. Mario http://onedayitwillmake.com -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Merrill, Jason Sent: Tuesday, May 19, 2009 9:37 AM To: Flash Coders List Subject: RE: [Flashcoders] unexpected result with linked classes in embedded swfs My understanding is that classes are only imported once and have a single instance in the player - so if .swf A loads in .swf B, and both use Class X, then if you change class X and re-publish only .swf A, you will see the change in both .swf and .swf B. I could be wrong, but that is my understanding of how the player handles custom classes. Jason Merrill Bank of America Global Learning Shared Services Solutions Development Monthly meetings on the Adobe Flash platform for rich media experiences - join the Bank of America Flash Platform Community -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Andrew Sinning Sent: Tuesday, May 19, 2009 9:28 AM To: Flash Coders Subject: [Flashcoders] unexpected result with linked classes in embedded swfs I'm working in AS2. The skin-swf that I am embedding into my main movie contains symbols that are linked to classes. Objects in my main movie make calls to some of the classes that are defined in the skin. In order to get nice code-hinting in Flash Develop and compile-checking, I import these same classes into some of the objects in my main-movie. If I make change to the AS file for a symbol defined in the skin-swf, but ONLY recompile the main-movie and not the skin-swf, I wouldn't expect the changes made to take effect, but they do. Does this make sense to anyone? For example: if I add a new function to a class that is linked to a symbol in the skin-swf, and I call that function from the main-movie. I would expect to have to recompile both the skin-swf and the main-movie. However, what I've found is that I only have to recompile the main-movie. It seems that if the class is imported into the main-movie, then those instructions override the instructions compiled into the skin-swf. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders __ Information from ESET NOD32 Antivirus, version of virus signature database 4087 (20090519) __ The message was checked by ESET NOD32 Antivirus. http://www.eset.com __ Information from ESET NOD32 Antivirus, version of virus signature database 4087 (20090519) __ The message was checked by ESET NOD32 Antivirus. http://www.eset.com ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] unexpected result with linked classes in embedded swfs
Hi Andrew You have one of two approaches you can take when working with exclude files. If you want your skin swf to be the owner of the skin classes *and* provided that you will be loading the skin.swf into your main movie *prior* to attempting to access any of the skin classes, then you would apply the exclude xml against the main.swf. Now if you change your skin classes you will need to republish just the skin.swf. In theory this approach makes your main.swf file smaller and makes maintenance easier. If you want your main.swf to own the classes but the skin swf to merely utilize them, then you would apply the exclude file against your skin.swf file. This would be the case if you have several skins that you want to load, but only want to republish the main.swf when you change your classes. But either way, the exclude xml prevents those classes from being compiled into the swf that it is applied against. The swf still compiles and does error checking against those classes but it simply doesn't include the class definitions. The expectation is that the class will be loaded into memory and be present at runtime prior to the first call to instantiate the class. When I was developing for AS2 I would basically build out the project for the most part, then start looking at using exclude.xml files to optimize the load strategy. Or, if there were multiple swfs loading the same classes then I would make a single class library swf that I would load in first in my load strategy so that I was assured that I would not get interference patterns occuring. By interference I mean the situation where the first instance of a class loaded is the one used, if you mess up and publish one file but another references it and loads first then the older version of the class will be used, not the newer version. In these cases I just make sure I have one swf that loads the classes upfront and worry strictly about republishing it, then later optimize out the classes from the other files when I'm nearer the end of the project. AS2 had its way of dealing with things, AS3 changes most of those premises. AS3 doesn't allow the use of exclude xml, you have to play other tricks such as class libraries that are external in Flex Builder and the like and deal with ApplicationDomain and the ilk, none of which are valid for AS2 development. Sincerely Mark R. Jonkman - Original Message - From: Andrew Sinning and...@learningware.com To: Flash Coders List flashcoders@chattyfig.figleaf.com Sent: Tuesday, May 19, 2009 10:35:13 AM GMT -05:00 US/Canada Eastern Subject: Re: [Flashcoders] unexpected result with linked classes in embedded swfs Jordan, Mark et all advised: If you are going to have your class used throughout various linked swfs, then keep it in your main movie and exclude the class from the links swfs when compiling (using an exclude xml file). Thanks! This is really helpful. It seems so stupid of me to program the skins this way, and having to keep recompiling them (as I thought I had to) was really becoming a pain. My skins take a lot longer to compile than main movie, even though they contain much less AS. Must be the graphics So, in my library in the skin, I will link the symbols to the external AS in the same way, but then I'll use an exclude file to prevent them from actually getting compiled into the swf? Then when the skin-swf gets loaded into the main the symbols will find their classes? ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] unexpected result with linked classes in embedded swfs
Know the feeling! We have about 20 files using the same class files. It makes more sense for us to keep them in a central core file and simply compile one file. The skin swf will reference the classes from your main file as if they were compiled into the swf. The only noticeable change should be a slightly smaller size for your skins as the AS2 code is not compiled. jord Andrew Sinning wrote: Jordan, Mark et all advised: If you are going to have your class used throughout various linked swfs, then keep it in your main movie and exclude the class from the links swfs when compiling (using an exclude xml file). Thanks! This is really helpful. It seems so stupid of me to program the skins this way, and having to keep recompiling them (as I thought I had to) was really becoming a pain. My skins take a lot longer to compile than main movie, even though they contain much less AS. Must be the graphics So, in my library in the skin, I will link the symbols to the external AS in the same way, but then I'll use an exclude file to prevent them from actually getting compiled into the swf? Then when the skin-swf gets loaded into the main the symbols will find their classes? ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] unexpected result with linked classes in embedded swfs
Currently I only have one skin, but we plan to build more skins, at which time we'll probably start to over-ride some members of various classes to suit individual skins. If I do this by extending a base-class, will I be able to keep a base class in the main-swf, exclude it from the skin-swf, and still extend it in the skin-swf? So then at runtime the extending class will use the base-class in the main-swf. This makes sense to me. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] unexpected result with linked classes in embedded swfs
Yes. That would be one of the use cases for the exclude feature. Sincerely Mark R. Jonkman - Original Message - From: Andrew Sinning and...@learningware.com To: Flash Coders List flashcoders@chattyfig.figleaf.com Sent: Tuesday, May 19, 2009 11:41:09 AM GMT -05:00 US/Canada Eastern Subject: Re: [Flashcoders] unexpected result with linked classes in embedded swfs Currently I only have one skin, but we plan to build more skins, at which time we'll probably start to over-ride some members of various classes to suit individual skins. If I do this by extending a base-class, will I be able to keep a base class in the main-swf, exclude it from the skin-swf, and still extend it in the skin-swf? So then at runtime the extending class will use the base-class in the main-swf. This makes sense to me. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders