Flex :: SWF Assets Loaded Into Flash SWF At Runtime Within Same ApplicationDomain

Dec 1, 2009

I'm trying to load a swf compiled by the Flex SDK into a swf exported by the Flash IDE and instantiate the assets by way of getDefinition(). Normally this works fine with assets exported from the Flash IDE then loaded into another swf also from Flash IDE.This is how I could normally do this using only the Flash IDE:Loader - > Using same ApplicationDomain - > getDefinition(class)Now, using the 'Test.as' compiled from Flex SDK using the [Embed] metadata tag:Loader - > Using same ApplicationDomain - > getDefinition("Test_" + class)The problem is I'd rather not have to keep track of the asset libraries loaded to prefix the class name I'd like to get (('Test_" + class) vs (class)). Is there any way of doing this without referencing the library the class is being pulled from or without accessing the original loader? This way I don't need to know which swf the asset is coming from, just the class name that I could instantiate from the current ApplicaitonDomain.

View 1 Replies


Similar Posts:


Flex :: Swapping Movieclips With Other Assets At Runtime In A Flash Component

Sep 2, 2011

I have an animated character swc that is an empty skeleton basically (has all the body parts, animations, and functions/vars). I want to essentially put different clothes on that character at runtime so I don't have to have many copies of this character in my resources.

For example, I have 'skeleton' (the non-clothed model) and 'Bob', 'Jane', and 'Mary' characters. 'skeleton' is animated and fully works as an exported swc, and to get the other characters in their clothes/skins, I open up Flash CS5 and replace the movie clips with the 'clothed' versions of the components. To clarify,'skeleton' has "body parts" as movie clips that are all animated on the timeline, such as "head","face","left arm","right arm", etc. I open up 'Bob', who has the same exact design as 'skeleton', with the exception that 'Bob' has all the clothes and such as differently-designed movie clips. The size, shape, orientation, and reg points are all the same across all the components. After I've replaced all the movie clips in 'skeleton', I export it as a swc named 'Bob.swc' and I do this for all the characters.

What I'm asking is, how can I do this process ^, but at runtime instead, so I don't have all these duplicate root swcs ('skeleton' has a lot of frames on it) so I can cut down on a bunch of space? So I can do something like:

// bob gets all the actions and animations of skeleton
var bob:UIMovieClip = new skeleton()
// replace the body movieclip with a new looking one
bob.body = resources.bodyassets['bob']['body']

View 1 Replies

Actionscript 3 :: Runtime-loaded Assets Consume Memory/resources If They're Not Being Used?

Mar 12, 2012

I'm making a game for the browser that has a lot of assets, but not all of them are needed at once. I'm deciding whether to embed my assets at compile time or load them at run time. I'm not concerned about loading time -- only the performance of the game during run-time.

If I load these assets and store them into memory for eventual use later in the game, will they consume system resources just being latent in an AssetLoader? Will that affect performance?

If I embed these assets, will they consume system resources just being latent in the compiled SWF?

Is there a difference in performance between these 2 methods?

View 2 Replies

AS3 :: Flash - Get ALL Definitions In An ApplicationDomain Of A Loaded SWF?

Nov 10, 2010

When load and SWF into another, the loader SWF can get definitions in the loaded SWF using ApplicationDomain.getDefinition(name:String) in example:

package
{
// ... imports
public class SWFLoader extends Sprite

[code]....

how can I get ALL the definitions and not just ONE of them?

View 4 Replies

ActionScript 3.0 :: Loaded Sub Swf - Want Different ApplicationDomain?

Apr 13, 2009

I have a main swf that is a container for various flash games. I want this "console" to be in a different applicationDomain as the games to avoid class/function naming problems. As I understand, the default behaviour allows loader and loadee to exchange information. How do I make sure that classes for the console doesn't interfere with the games?

View 3 Replies

Web Development - Assets Loaded In Flex / Images Wont Update?

Nov 11, 2010

I build a project with Flash Builder. I copied everything from the "bin-debug" directory to a server (including all images we use which are under /assets).

After I have updated the project, and a few images, i recopy the primary .SWF file (Main.swf) and everything under assets up to the server again. Unfortunately, when I run the application, I am clearly running all of the updated code but the images have no updated.

The new SWF was definitely copied up as well as the new images (I can say that with 100% certainty), and additionally, I cleared my Flash Cache, so that's most likely not the problem either.

[Code]...

View 1 Replies

ActionScript 3.0 :: Modifying Library Assets At Runtime?

Feb 19, 2010

I'm building an avatar class that will allow a user to swap out character assets during runtime. The idea is pretty straight forward. The artist I am working with designed the art assets for the individual pieces of the avatar and performed the animations in flash. Since the animations were created in flash using vector art as opposed to pre-rendered 3d, I want to simply replace each individual movieclip within the animation with the asset selected by the player.

Problem:The issue i'm running into is that the animations have several key frames. My thought is to load the avatar object (an external swf) into my main application. Once loaded, I obtain a reference to all library assets that are used in the animations. For example, to get the face, I have something like:

Code:
if(this.loaderInfo.applicationDomain.hasDefinition("face"))
{

[code].....

View 4 Replies

ActionScript 3.0 :: Switching From Embedding Assets To Loading At Runtime?

Mar 8, 2011

I have been handed a project that was built to embed all assets at compile time and I need to update the app to load assets from a remote server instead. Right now everything is being embedded as follows:

[Embed(source="assets/gfx/tutorialBg.png")]
public var tutorialBg:Class;
[Embed(source="assets/gfx/tutorialStraightArrow.png")]

[Code]....

These Class variables are being referenced all over the app to place the assets so I'm hoping to be able to update the code to load the assets and store them in these same Class variables. So far the methods I've tried have not worked. I've tried using URLLoader and it loads the images fine, but I'm not then able to extract the image and cast it as type Class to these variables.

View 0 Replies

ActionScript 3.0 :: Runtime Shared Library - Main And Assets SWF

Mar 26, 2009

This is the concept I want to get into code:
1) Have a Document Class attached to the Main.swf
2) Have a Assets.swf that has all MovieClips that set to Export and have been given actual Classes.
3) Have the document class Load the Assets.swf.
4) Once loaded, be able to create instances of the MovieClips from Assets.swf by writing the code in the Document Class of Main.swf

I can get all this to work.. However what I am finding is if I have a public function on the Document class that creates an instance of something from the Assets.swf, lets say var okTest:TestClass = new TestClass(); I have to also import it in the Document Class (import com.test.TestClass). When I compile it, yes it works. If I remove the Assets.swf file it doesn't display. Ok.. But I've noticed that the Main.swf file is including all the imported classes (eg: com.test.TestClass) so the Main.swf filesize is pretty much the same as the Assets.swf file.

I also ran it through a decompiler and can see yes in fact Main.swf is including all those Classes from Assets.swf because I'm trying to access them from Main.swf and had to import. So the biggest question is how do I go about this properly? Being able to load the asset file that has movieclips etc that have custom classes. Then create instances of those classes within the document class but only if Assets.swf is loaded.

View 2 Replies

Flex :: Using 9-Slice Scaling With Images Loaded At Runtime?

Nov 8, 2010

Is there a way to use 9-slice scaling with images loaded at runtime? To clarify, let's say that I build an application that lets a user skin a button with whatever image they want. This would be an image that's not embedded with the swf. Is there a way to set that runtime image as a background and use 9-scaling?

View 1 Replies

Android :: Flex Styles Not Loaded At Runtime In Devices

Dec 8, 2011

I want to load my styles (in swf format) at run time for my flex mobile application. For that requirement, I have compiled my css files into swf format and I loaded for my application using "StyleManager.loadStyleDeclarations("style.swf");". I get my styles for application when I run it on my desktop, but after building my files into apk format, I couldn't get the styles applied for my application in device. When I debug my application from my android device, I got the following error message.

Error: Unable to load style(RSL app:/framework_4.5.1.21328.swz failed to load. Error #2032: Stream Error. URL: app:/framework_4.5.1.21328.swz): style.swf. at Function/<anonymous>()[E:dev4.5.1frameworksprojectsframeworksrcmxstylesStyleManagerImpl.as:1551]
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
[Code] .....

View 1 Replies

Flash :: Self Updating Air Application Assets Without Re-downloading Assets Already Downloaded

Feb 10, 2011

I want an air application to be able to update the assets it uses, but minimizing the download needed, so only downloading files added since it last updated.I'm thinking this would include a server portion which would zip the needed files based on a version number? Has anyone implemented anything similar / got any thoughts on the best approach to building this sort of system?

View 1 Replies

Flex :: Specify ApplicationDomain.currentDomain When Loading Via SWFLoader?

Jan 26, 2011

I'm using Flex Builder 3 to build what will be a fairly large project. I'm suffering from modules stepping on each other and a conflict between application/module. My structure looks something like the following:

[Code]...

View 1 Replies

Actionscript 3 :: Manage Loaded Assets?

Jul 23, 2011

I'm working on an AS3 project that must load a lot of external files; images, sound clips, movie clips etc. The program first loads an XML file that contains the file names of all assets needed by each class. From that point on I'm not sure what would be the best way to distribute those assets.I thought about making a dedicated assets class that will load everything the XML object describes, and then pass it to each class' constructor so they can access the objects they need. This seems like the "tidiest" option, but is there a best practice way for managing loaded assets?

View 1 Replies

ActionScript 3.0 :: Externally Loaded SWF Assets

Jan 30, 2009

Can anyone explain the model for actionscript in externally loaded SWF assets? For example, suppose the stage owner uses methods from Class1 and that it loads an SWF file with an asset that also uses methods from that class. This means the code for Class1 is included multiple times in the application?

View 3 Replies

Actionscript 3 :: Make A Flash Library That Can Be Either Compiled In Or Loaded At Runtime?

Oct 29, 2010

I'm looking to make a library that can be either merged into a swf at compile time or loaded into a swf at runtime. The way I understand it, .swc files are generally merged into a swf at compile time, and .swf files are generally loaded into a swf at runtime. Is there a way I can have one file that can do both?

View 2 Replies

Flash - What's The Definition Name For Fonts Loaded At Runtime Created With Fontswf

Apr 11, 2011

I ran into the 'fontswf' utility to embed TTF fonts into SWF and I am struggling to load them at runtime from my app. All the examples I find online refer to loading the font via [Embed] but I am actually loading them with a flash.display.Loader and from what I gather, once the Loader.contentLoaderInfo fires an Event.INIT I need to register the font, like so:

public function handleLoaderComplete( event:Event ):void {
var FontClass:Class = event.target.applicationDomain.getDefinition( fontName );
Font.registerFont( FontClass );
}

The problem is I don't know what to pass in as fontName. I am generating my SWF through:

$ fontswf -a belshaw -o belshaw.swf belshaw.ttf

But when I try to call getDefinition( 'belshaw' ), I get an error saying 'Variable belshaw is not defined'. Any suggestions on how to accomplish this?The alternative is to generate my on SWF files through templating an .as file and compiling them, but I would rather use a built in tool like fontswf if it's already there.

View 2 Replies

Actionscript :: Embedding Flash Assets In Flex Project?

Jan 28, 2010

I'm creating a project in flex builder but it's not using the flex framework, it's just pure actionscript.

At the moment I have some bitmap resources embedded for drawing things, but I'd like a little animation and thought I could create swf animations for them in flash and use the [Embed()] thing to embed them in the actionscript project.

This works perfectly well for me, however I'm a little concerned about efficiency and how well this approach will scale when my project gets larger.

Does anyone know if there are any efficiency implications to embedding maybe 20 or 30 swf files, or do they get efficiently integrated into the main swf file? Most of the animations are really simple and I could probably redo them in actionscript if needed but it's a lot easier just to draw them in flash and embed them.

View 1 Replies

Flash :: Flex - Using The Vanilla Preloader To Load Additional Assets?

Jan 27, 2010

I have a Flex application that automatically loads the SWF and it's contents and displays the default progress bar like in all Flex apps. Currently I have a class in the application using a Loader instance to load an external bitmap to be added to the stage/canvas. I'd like to handle the loading of this bitmap in the Flex default preloader and get rid of the Loader instance entirely.

View 1 Replies

Flash :: Flex - Statically Embedding Of Assets File Weight?

Mar 21, 2012

When embedding assets of any size in the following manner -

[Embed(source="../../assets/Assets.swf", symbol="LargeButton")]
public static const ButtonAsset : Class;

it looks like the resulting SWF size jumps up ~2.8KB (in addition to the size of any assets that are actually embedded).

So I have a few related questions:

Is this because flex_sdk/frameworks/libs/core.swc must be statically linked? Is there any way to get around this restriction, perhaps by cherry picking the necessary files and compiling them to a SWC file?? Note that in the app I am writing file size is critical.

Is there a command/plugin that would allow for the transcompiling of vector graphics (drawn in the Flash Professional Authoring Environment) into raw ActionScript 3 ?

Use cases compelling this feature are improved workflow - would allow designers to draw assets in Flash Professional, compile to an asset SWF, and then be able to embed those assets (versus having to take the time to load them at runtime, or going to the effort myself to write them in ActionScript).

View 1 Replies

ActionScript 3.0 :: Can Buttons/assets Be Loaded Externally And Referencing Dynamic Content By Name

Jul 30, 2009

I have a widget containing a number of displayobjects, i.e. up arrows, down arrows, tab 'buttons', backgroundrectangularblocks, sliders, company logos etc.I am currently creating these displayobjects using the graphics class with parameters taken from an external file, things such as fontsize, font, colour, width, height e.t.c and adding them as children of "container" sprite objects for easy manipulation and referencing later can these assets be loaded in their entirety externally, rather than being created using graphics class draw methods (which I want to avoid) as some of the things I need to design cannot be created in pure actionscript very easily (if at all?), and then used or do they always have to be in the library and instantiated from there?

if the first question is yes they can be loaded externally, this question probably isn't needed; however, if I have to put the items in the library and recompile each time a client wants to use say a curved blue up arrow instead of a yellow one and then decides he wants a yellow circle instead then how do I write the code to do the following:-Say on my first ever compile I have 'upArrowBtnset1' in the library, I instantiate it and use the instance name to access it in the usual way using standard code,

upArrowBtnset1.addEventListener.... container.upArrowBtnset1.scaleY = .3 e.t.c

Now if they send me a second set of 'upArrow' graphics they want to use I could either update all the upArrowBtnset1 assets with the new graphics meaning the original set is no longer available to the client and I would either have to hold a "original set" FLA file with the first set of arrowbuttons or I could import these to the library as upArrowBtnset2 and a third set they send as upArrowBtnset3 and so on each time I am sent some new assets; I would then recompile them into the SWF and adjust the references to the new assets within the code. In the code, for each instance of "upArrowBtnset1" I would have to rename them to "upArrowBtnset2", recompile and send it back to the client.

Because I have already abstracted the font/colour/size choices out to an external file, they can change that as much as they like without a recompile which is what we want. The problem comes if they want to use set1 again and haven't kept the original "set 1" compiled SWF. It would be easier to abstract the 'setchoice' also to the external file. The SWF would over time build more and more available sets that they could use by just changing an external variable.

For example, if the designer wants to use set 1 on Monday, set 2 on Tuesday and set 3 on Wednesday I want to make it so they can just adjust an option in an external file to "setchoice = 3" for weds instead of either having to recompile the swf each time or they have to have 3 versions of the SWF for each asset set. The idea is that as more and more assets are added in, they have more and more choices. Ideally, in an external file there would be a list of assets and links to where they are loaded from. (i.e question 1 above).

If I have an external file (say XML) which holds the setchoice option that the designer wants to use (say they want set3 today) my 'generic' code has to be something like upArrowBtn(setchoice).scaleY and every instance in the code where that object is used I append the 'setchoice' as chosen by the designer from the external file where (setchoice) is retrieved from something like var setchoice:String = "set3"; from the external file (I am currently abstracting all the adjustable variables to a configuration.as file. I will work on using an XML later when the principle of external files works (I hope!);

Is it possible to import assets from external sources and then use them in the SWF as if they were in the library? The loader class? Is this just fraught with danger I wonder.

Essentially I am being asked to remove as much as I can from the SWF so that if the client wants to change the positioning of things on the stage or the text on buttons or change the style of the buttons or the company logo they don't have to come back to us to ask for a recompile of the SWF for each tiny adjustment. Inevitably SOMETIMES a recompile will be unavoidable (such as if they want the widget to suddenly be twice as wide (i.e. the stage). My code already handles some of this using stage.stageWidth and then positioning objects relative to other objects already on the stage using this value and centred so that just changing the document properties is all I would have to do and everything else adjusts proportionally. I am trying to make this as reusable as possible with as little effort from myself as possible to save our company wasted time.

After all that waffle, my question is this, if I can't load all my buttons and assets and things externally, how do I write the code for this:- I have a library asset called upArrowBtnset1 and another called upArrowBtnset2. Instantiated with say upArrowButtonset1 and upArrowButtonset2 The code would normally be upArrowButtonSet1.x = 100; upArrowButtonSet2.y = 300; but I need it to be upArrowButton(setchoice).x = 100; upArrowButtonSet2(setchoice).y = 300; where (setchoice) comes externally from var setchoice:String = "set1";How does the code change if the (setchoice) string was named not at the end i.e 'button(setchoice)UpArrow'?

ActionScript Code:
var numClips:Number = 5;
for (var i:Number = 0; i < numClips; i++)

[code]....

I need to do something like, getChildByName("mainTab"+i).addChild(myMovieClip) ? or maybe this["mainTab"+i].addChild(MovieClip)?Is it possible without using .name?

View 0 Replies

ActionScript 3.0 :: Use Flash.import.system.ApplicationDomain For Local Use

Feb 25, 2010

how to use this package but I can't seem to understand how to use this for local usage.

View 2 Replies

Flex :: Action - Reuse Flex Library Assets?

Dec 24, 2010

I want to reuse the TitleWindow's closeButton inside a simple Flex component I am writing, but I'm having trouble getting it to compile. I copied the code that deals with the closeButton, which looks somewhat like this:

[Code]...

View 1 Replies

ActionScript 2.0 :: Swf Is Loaded Into Another Swf At Runtime?

Jul 18, 2006

I have a question about movie clips and levels. I have a small contact form. Everything is working fine. The client wants to add more content so I need to make the whole SWF scrollable. My first instint is to just make the entire swf an MC and then add the ScollPane. My problem is that once I make the various input elements into an MC they stop working. I figure this has something to do with levels. I am afraid to play around with _root too much as this swf is loaded into another swf at runtime.This is just a little chunk pulled out form the code. contact_us is the name of the stage MC.

[AS]
for( var elem in inputs) {
contact_us.inputs[elem].border = true;[code].....

View 2 Replies

Difference Between The Flash Player Runtime And Adobe AIR Runtime?

Nov 16, 2009

I've been into coding for about 5 years now, but I'm a recent convert to Flash development. One of the questions I have at the moment is, considering that SWF files can be run by either Adobe Flash Player OR Adobe AIR, what's the real difference between the two runtime environments? What API's and Objects exist in one environment, but not the other?

Basically what I'm more or less trying to establish is, when would I want to develop an SWF for AIR, and when would I want to develop for Flash Player, considering that Flash Player can also execute locally (providing support for creating "desktop applications")

View 1 Replies

Flash :: Flex: Getting CSS Class Name At Runtime?

Mar 19, 2012

How to get CSS class name of any UI Component at runtime?

View 1 Replies

Flash :: Flex Set CSS Class At Runtime?

Mar 23, 2012

I know how to set individual style names to a UI component but what is the way to set set the CSS class itself?

View 1 Replies

ActionScript 2.0 :: Communicat With SWF Loaded At Runtime?

Nov 21, 2010

I've a file named, Load.SWF in which I am loading RFC.SWF on first frame with following code... container_MC.loadMovie("RFC.swf");Simple code. 'container_MC' is a movieClip instance on the stage in Load.SWF. The file RFC.SWF contains 4 frames with a stop() action on 1st Frame. Now I want to create a button in my Load.SWF file to send the RFC's playback to frame 3, but I am unable to do this. I am using the following script on a button in Load.SWF, but its not working... on (press) {
container_MC.RFC.gotoAndStop(3) }

I am working with a AS2 file in Flash CS3.

View 1 Replies

ActionScript 2.0 :: F8 Use Loaded Text Data On Runtime?

Feb 17, 2009

I have just started with creating Drawing Pad, which can save and reload the image drawn once. I have completed the basic interface which includes drawing and erasing part. I am storing the co-ordinates in a text file. I am using MultiDimensional Array to store X,Y co-ordinates. But now I am facing a problem that how to load these variables into the flash back and using these redraw the image. I tried using 'loadvars', but it didn't helped me as it doesn't return string data. Can somebody help me in this so that I can load co-ordinates from text file and redraw the image.

View 4 Replies

Actionscript 3 :: Calling Function In A Runtime Loaded Swf?

Dec 11, 2010

My problem specifically I am designing a user interface with controls on it. 5 buttons rotate left, rotate right, zoom in, zoom out, and auto rotate. The interface in itself works fine, I can trace out button clicks, toggle the auto rotate button etc...

My program reads an xml file. Loads some images, fills an array with links for each image, and when the image is clicked a loader loads a swf from a URL and displays it on screen. No problem.

Now I originally had the zoom controls user interface in the runtime_loaded.fla library, and the mouse listeners in the same linked document class. The interface works with the movieClip in runtime_loaded.swf when it is in the same code.

[Code]...

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved