AS3 :: Flash - How Are SWFs Are Compiled From External .as Class Files
Oct 5, 2011
In the Flash app I'm building, I have a "main" SWF that will load a variety of "child" SWFs.
All of the AS3 code for both the main SWF and child SWFs is contained in external .as class files.
In other words, each movie has it's own document class .as file.
There are also a number of .as class files for all of the common elements (e..g, UI buttons and controls).
So - for example - both my main SWF and all child SWFs use the "MyCommandButton" class; the code for this class is in MyCommandButton.as, which all SWFs reference (import).
Here's what I don't understand.
(Let's say that the code in MyCommandButton.as draws buttons that are red.)
First, I compile ALL of the child SWFs.
Next, I change MyCommandButton.as, so that the buttons it draws are blue, instead of red.
Then, I compile the main SWF.
When I run the app (main.swf), I would expect all of the buttons in the main SWF to be blue (since that's what MyCommandButton.as specified when main.swf was compiled), and all of the buttons in the child SWFs will be red (since that's what MyCommandButton.as specified when they were compiled.)
Instead, ALL of the buttons are blue, which means the change I made to MyCommandButton.as affected all of the child SWFs, even though I didn't recompile them.
View 1 Replies
Similar Posts:
Jul 30, 2009
The problem is class files being cached in external swfs when they are loaded into another swf. (as2-cs3). In a nutshell, we've got a clip on the stage that is linked to a class. You can make changes to the class, pub the swf and everything works fine. When we then load that swf into our application swf, the changes are all lost, and it "reverts back" to a previous version of the class.
View 9 Replies
Aug 25, 2009
I know that typically, a loader class normally can load in either a swf or an image file (like a jpeg), but there were some swf files that just would not load for some odd reason. So I decided to do some trial and error tests and discovered that the problem was coming from swfs that were compiled from flex.
At this point I decided to try a different approach and compile from flash instead using the .as file as a document class in a blank fla. I received the same effect of it not being loaded. It could not have possibly been a coding problem with the swfs compiled from flex; they were working fine on release-builds.
I've come to the conclusion that the problem is not with flex or flash, but just compiling swf from a document class. I did more research into the problem, and I only found that document class compiled swfs have only 2 frames (first one being the preloader, and the second being everything else). They had some example codes on using the loader class with these swfs, but the code only demonstrates with traces when its loaded; they don't actually explain or show how to make the swf viewable the way it should.
[Code].....
View 1 Replies
Sep 9, 2010
Is there a way to share common .as files with multiple swfs?
View 5 Replies
Jun 6, 2010
I'm using Flash cs3. I have an as3 file next to my fla file which contains all the specific actionscript for that file. Then, through the source path in the fla's "Publish" settings I am pointing to an external folder with all the other necessary classes.When I press control + enter to compile the file it works fine. But when I try to see the published file embedded in a webpage on another computer, the swf won't display in either chrome or firefox. It will display in IE though. If I copy all the actionscript files into the same folder as the swf, the swf will display in all browsers. Is there no way to have the script in external as files to compile into the published swf file?
View 6 Replies
Apr 6, 2009
I am dynamically loading external SWFs in a Main Fla in response to clicks on a menu.
The loading code is standard and works fine for all of the SWFs except one. When I try to load it I get the following error: Error #2044: Unhandled IOErrorEvent:. text=Error #2035: URL Not Found.
I am certain that the URL to the problem SWF is correct. The SWF itself doesn't load any other SWFs or images. The problem SWF is linked to an external class file and compiled with it. i.e. in the properties panel of the main timeline of the problem SWF's Fla I have entered the path to the external class.
1. there is no problem compiling this SWF with the class (it works fine by itself)2. if I remove the external class from the properties panel and don't use it the resulting SWF imports without a problem into the Main Fla mentioned before So the problem seems to be the fact that the external class is linked in the properties panel. Is this a path problem?
View 3 Replies
Mar 29, 2010
I compiled two swfs into a single exe using a converter. Both swfs have the same 5 tabs for the 5 sections of my presentation. Swf A has all the stuff for the first 4 tabs, Swf B has the stuff for tab 5. When I start the exe & navigate all around in the first 4 tabs & their sub-sections, everything's fine. I can also click on tab 5 & the Swf B stuff starts playing right away & I can navigate all around in there.
BUT... After I've been clicking on the tab 5 stuff, if I click on any of the 4 tabs from Swf A it kicks me all the way back to the intro animation at the start of Swf A. What I need is to have it go to the first frame for each of those tabbed sections. (e.g. frame 5, 38, 93,...) I did gotoMovie & then gotoAndPlay & the frame number, but it sends me back to frame 1 anyway. How do I get it to go to the frame I want? This is in AS 2, by the way...
View 1 Replies
Apr 3, 2011
I compiled a simple AS3 project using Flex 3.5 (also tried Flex 4.1) to create a small swf which draws a simple red square on screen. Nothing too complex that requires special flashplayer support (see code below)
package
{
import flash.display.Sprite;
/**
[Code]....
and tried to load it into a AS2 swf I have compiled using Flash CS4. But that just didn't work. I don't get any errors when loading and the AS2 swf can load any swf, either compiled in AS2 or AS3 by Flash.
View 1 Replies
Jun 16, 2009
I use flash CS3 on Mac OSX and I'm creating several AS2 projects with .as class files. Everything code-wise is working perfectly. The problem comes when I make a change to a particular class file, save the file, and the republish the fla. The changes are almost never reflected in the published swf. The only thing I've discovered to work around this problem and actually get my changes published is to publish to a different flash player version, and then republish back to the version I really want. Somehow that seems to actually get flash to load the most recent version.
It seems like this might be some sort of flash caching problem, but I have no idea how to tell it to always check for the newest version of the file.
View 2 Replies
Jun 25, 2007
I'm having some problems importing a class, the message that Flash gives me is this; The class being compiled, 'ImageLoader', does not match the class that was imported, '[URL]'. The only line of code in my flash movie is this: import com.martijndevisser.*; And yes, the class is in that folder The class is from here: [URL] I've used the class before and it works fine, I just dont know what to do?
View 4 Replies
May 15, 2008
ANYONE KNOW HOW TO Preloader and Transition for Dynamic Files AND Transitions Between External SWFs MIX TOGHETER...
View 1 Replies
Sep 2, 2006
[URL]regarding this tutorial I started my site [URL] to get some trasition effects but im getting somewhat different since the external SWFs take time to load. isn't it better to create "intro and outro" on the same time line instead of loading external SWFs bcos once the movie loaded as a whole will lead to smooth and contineous transitions.
View 1 Replies
Mar 9, 2009
In AS3 i am using the Loader class to load in multiple external SWFs (AVM1), each of which has a short animation which automatically plays when the swf is I obviously cannot control the timeline of these (i can't use local connection etc) but would like to load in the *.swf files, so they're in memory then add them to the stage when requested. the problem is that if i load them enmass. then use addChild when they are called, they have already played through and animated pre the addChild command.
(I cannot edit the swfs at all, and would rather not load them on demand at runtime)
View 5 Replies
Oct 29, 2009
I'm trying to set up a website that uses the MovieClipLoader class to load external images & swfs. The loader is working but I can't seem to get the preloader text to work, ie the onLoadProgress. The Percent text just has jibberish when I test the movie. Could some tell me what I'm doing wrong. Attached is the test file that I'm working on
[Code]...
View 3 Replies
May 3, 2009
I've got an external .as file in the same folder as my flash file. In the process of writing the code, whenever I make a change and then test the movie, the flash movie is obviously still looking at the OLD information. I tried using the "Delete ASO Files" on the menu, to no avail.I can' find these ASO files anywhere on mycomputer.Aha! I tried something else. I quit flash,restarted and ran the same script with no changes. It returned the data correctly, but then gave me this unpleasant message:256 levels of recursion were exceeded in one action list.This is probably an infinite loop.Further execution of actions has been disabled in this movie.There are no loops of any kind in the code, which is below.
//This is the Person.as file:
class Person { public var HomName:String = "unknown"; public var HomEmail:String = "unknown"; public var HomPhone:String = "unknown"; public var HomSaveFreq:Number = 0;
[code]......
View 27 Replies
Aug 15, 2005
I recently created a site using the "Transitions between External SWFs" tutorial for Flash MX 2004. I use this to load the sections of my site into the main movie file. Each section is an External SWF file. When a viewer clicks on a navigation button, the specific external swf move will load and play. Currently, a viewer would need to click on another navigation option to close the current external swf file. I would like to add a close button to each of the external swfs so that a view has the option to close the window without clicking on a naviagtion link.
View 12 Replies
Dec 25, 2008
I'm not sure whether to post this in a flex forum or here,but since the error is generated from AS3 code, I'll try it here.When I try to load a compiled flex swf with the loader class.As a test I tried 2 very basic programs:See the actionscript code in the attached code..As you can see I just load the swf without doing anything.I've found very few threads about this error, and even less solutions...Does anyone know if it's even possible to load a Flex swf?
View 8 Replies
Sep 11, 2009
I have a main fla file which loads an external swf into an empty movieclip on the main timeline which works fine but I want a button in the external swf to load another external swf into another empty movie clip on the main timeline.eg. start.swf loads UKEIAMap.swf into (empty movie clip within start.swf) MapLoader_mc then a button havant_b within UKEIAMap.swf needs to load HavantProjectSheet.swf into (empty movie clip within start.swf) ProjectSheetLoader_mc without unloading UKEIAMap.swf
View 3 Replies
Nov 13, 2010
I am loading eight external swfs by way of eight buttons with actionscript to remove the swfs and sound after a new button is clicked. This works fine except that as soon as you get to the frame where the actionscript is all the swfs load at one time on top of each other. I don't want any to load until the button is clicked for the right one. MouseEvent listener works but only after all the swfs have loaded. How do I get the swfs to load only when the buttons are clicked. I can't figure out what I am doing wrong.
[Code]...
View 5 Replies
Jun 11, 2010
i've only ever created external .as files that extended a class such as sprite. now i just want to create one that doesn't extend anything and call it from a frame script.
[Code]...
View 1 Replies
Dec 19, 2009
I'm working through actionscript 2.0 tutorials using Flash 8, and I'm getting apparent false syntax alerts from script files containing classes with static properties. The .as files seem to work okay when I run them with corresponding .fla files with the Test Movie option, and the code is copied straight from a Macromedia tutorial pdf manual. [code]...
View 0 Replies
Apr 25, 2011
I'm new to ActionScript and Flex but I was wondering, when do you create an MXML component and when do you simply code it in ActionScript? Does it matter either way, what are the pros & cons to both?
Does an MXML Component essentially create it's own class when compiled?
View 2 Replies
Oct 30, 2010
I am working on a feature for an application that requires Flex 4 functionality. Due to some migration issues of the application from Flex 3.5 to 4.0, I have decided to implement this feature as a module that is compiled with Flex 4.0. The theory is that the application would remain compiled in Flex 3.5 and load the module when it needs it.[code]
View 1 Replies
Apr 15, 2011
I've found this bit of code and it works for preloading my single 'Q1.swf' in an old AS2 project I did a while back. How do I adapt it to preload 5 swf's? Can I load them all to the same target mc or do I have to load them on separate levels or to different targets.I don't want to change the project to AS3 as the budget doesn't allow. Also will this work when the project is viewed from a CD as well as online?[code]
View 1 Replies
Feb 23, 2011
I spent almost a week trying to figure out how to unload a currently loaded swf using its button and loading a new swf... I have three files, a main.fla, file1.fla and file2.fla. In my main.fla, I have a code which loads the other two files. If i will click the "unload" button in the file1.swf, I would like the main.fla to unload the file1.swf and load the other file, file2.swf. Here is the code to load the file1.swf:
[Code]....
View 1 Replies
Feb 5, 2009
I am trying to prevent users from viewing my site and then simply going into their "temporary internet files" and stealing my swfs and XML files. I have been using a great .PHP code to stop this but now I am working on a server server that only uses .aspx files. Does anybody know of a way that I can stop files from being stored in the "temporary internet files" folder. I have encrypted the files but this is not good enough.
View 0 Replies
Aug 25, 2011
what I want and currently have is a main swf that loads in assets based on buttons pressed. I have 3 external SWFs (for the sake of this example, lets call the initial loaded swf "indexExt.swf", file two" f02.swf" and file three, " f03.swf") and in each of them,there's one layer that goes from frame 1 to frame 10. On frame 1, there's an "intro" label, on frame 5, an "outro" label, and on frame 10, an " end" label.
indexExt.swf is loaded on initial load of the main swf. as for my buttons, I gave my buttons on the main swf stage, instance names that are the same name as the external swfs so that with this line event.target.name + ".swf" I can call em in without having to re-write code for every button etc..
[Code]....
View 1 Replies
Aug 4, 2008
I would like the buttons to be in the same external SWF so I can animate them as well, the problem is I can't seem to get the actionscript to work, here's what mine looks like:
PHP Code:
container.button01.onPress = function() {
if (_root.currMovie == undefined) {
_root.currMovie = "home";
_root.container.loadMovie("home.swf");
} else if (_root.currMovie != "home") {
if (container._currentframe >= container.midframe) {
_root.currMovie = "home";
container.play();
}}}
And I've also tried using
PHP Code:
this._lockroot = true;
In the external SWFs but that didn't work either.
View 3 Replies
Jan 1, 2012
I've embedded a font in a flash based website. The site loads external swfs which also contain content in that font. Can these external swfs make use of the font without it being embedded in them?
View 1 Replies
Apr 27, 2005
i've created a project that i'm putting on cd-rom. this project calls some externals swf files. everything was working lovely until i tried it from the cd. all the called swf files are running way slow and it's just a mess.so i'm trying to figure out preloading to see if that will help. i used some script i found in a thread by Scotty, and looks like the external swfs preloaded okay. and i put a stop() on the first frame of each of the external swfs so they will not play immediately. but now i'm trying to call the swfs when i need them by using a gotoAndPlay(frame) and don't know what i'm doing wrong. i need to have these swfs not play on preload but when i call them, either by EnterFrame or onPress.[code]as an aside to this, some of the forums i've been reading say it's just bad to try doing all this with flash on a cd, that i should try rolling it into director. yowza, haven't touched director in a few years..
View 4 Replies