ActionScript 3.0 :: Loading Assets From A SWC?

Apr 22, 2009

Wherever I look it says that loading external assets(.png, .jpg, gif) from a SWC is supported. However, I can't find a single example of doing this with anything else than Classes and Components.

I have 7 swf's that are loaded and unloaded by a main swf, a sort of menu system. These swf's all rely on loading in some .png's at runtime.

I made a new "Library Project" in Flex, filled the scr folder with my .png's, set the loading type to "external". Because I don't want the .png's compiled into my application .swf.

But how do I get a hold of my raw .png's from within my classes?

I can do:
var obj:AComponentFromSWC = new AComponentFromSWC() no problem.

But I want to do:
var pic:Bitmap = BitmapFromSWC();

Is this possible or did I completely misunderstand the use of SWC's?

This way I could let all the apps use the same SWC and it is easy to distribute all the graphics as one package and the loaded swf could share common graphics.

View 5 Replies


Similar Posts:


ActionScript 3.0 :: Loading External Assets - Screen Stops Until The Loading Is Finished?

Oct 11, 2009

I have a movieclip clip that plays when the movie starts, the movieclip is a visual assets that show's that the application is loading some information but it's not showing any loading progress, just playing while the assets are loaded.I created a for loop that will load the assets using a simple loader, and then when the object is loaded the application push the object to an array.Problem is that when the loading starts all the animation that i have on screen stops until the loading is finished.The whole point is that the animation will play while it's loading.

View 10 Replies

Loading Assets From Different Libraries

Sep 8, 2009

I currently have a "container SWF player" that loads SWFs externally and plays them.The sound file for the SWF is in the library of the container SWF player, because the player is using the duration of the sound file to determine how long the scrubber bar goes.The problem is, it sort of defeats the purpose of having a container SWF player if I have to create a different container SWF player file for each external SWF because there's a different sound for each external SWF.Is there a way to pull the sound file from the library of the externally loaded SWF into the container SWF player?So that depending on what external SWF is playing, it will pull the associated MP3 file from that SWF's library?

View 1 Replies

Loading Assets In Timeline Animation?

Jul 28, 2009

I have an animation that is timeline based. The file size is around 900kb for the entire project, as it has numerous images at different stages.

How does flash determine when to start playing the movie? Is it based on a percentage of loaded size or does it load assets as it moves along?

View 2 Replies

Actionscript 3 :: Loading Assets From External Swf?

Aug 18, 2010

I am trying to load assets from an external swf. As in:

I drew a square in flash Made it into a symbol made sure to check the "Extract for Action Script" to doubly check I created an instance of it from within the asset file. went to my loader file loaded the assets.swf tried to find the class variable using "getDefininition" FAILED.

from what I'v been seeing from around the web the following code should work. (I actually copied it word for word from one of the tutorials) but it doesn't work.

import flash.system.ApplicationDomain;
import flash.display.MovieClip;
var myLoader:Loader = new Loader();

[Code]....

there should definately be class definition for XIconG though because I tried it myself from within the Asset.swf file. also I'm not sure whether this helps you, but when I tried to debug, I looked at the event.target.applicationDomain variable from the debugger menu and under it it said domainMemory = null. I don't have a clue why that is though.

View 1 Replies

Ios :: StageWebViewBridge Loading Included Assets?

Sep 16, 2011

My priority is to have a fullscreen (standard size) 1024x768 H264 video played on an ipad app compiled with flash CS5.5 AIR for iOS using the StageWebView class. This works perfectly fine. Although with no official way to communicate with the StageWebView, I can't 'remove' the video once it's done playing. Enter StageWebViewBridge which enables AS <=> JS communication.

I'm trying to get around the overall poor performance of the Video class on the iPad (1 or 2). Playing the video inside a StageWebView loading a html5 object works amazingly great (read: GPU hardware decoded h264).I do need to shut the video off after it's done playing in the StageWebView. I am packaging a .mov file encoded in H264 that plays great in webkit browsers. If I just load a webpage in the StageWebView with a tag pointing to any video file it plays perfectly fine.

Once I introduce StageWebViewBridge it changes. They want files put in a /html folder. I'm sending paths of all kinds for the players src to play and no video ever loads. The video is named 'a.mov'. I tried player.src = 'a.mov', or player.src = 'html/a.mov', or player.src = './html/a.mov' or even using the File class to get the File.applicationDirectory and resolve the file to the .nativePath. No matter what I send from AS to the JS in the StageWebView page, I cannot get it to load the video.

how to reference embedded files? I'd like to send the file to load from AS to JS and have JS reset the .src property of a html5 element. Even the File.applicationDirectory reference I make states the file 'exists', but I can never set the .src property of the element on the page. It doesn't seem to understand.

View 2 Replies

ActionScript 3.0 :: Embedded Swf Not Loading Assets?

Oct 3, 2011

I have a site that contains a page with a fancybox pop up which contains a .swf.This swf loads a sound file and a thumbnail (mp3 and jpeg). When I view this by double clicking the swf it works fine, when I navigate directly to the swf in the browser it works fine, however when I try to view the embedded swf it does not load the jpeg or the sound file. I have another page which does the exact same thing except it loads a different swf which only loads a video file and this works perfectly.

AS3 code :

Code:
package www.elementalstudios.co.za {
import flash.display.Sprite;[code].....

Where the $theInner is a javascript variable that is used to set the innerHTML value of the div that I want to have containing the swf and $jUrlArray is an array of filepaths to various folders containing different sound files and thumbnails (each folder also contains the swf).The thinking is that the swf looks for the files as "sound.mp3" so the swf would assume that file is in the same folder it is in, therefore I'm only loading the swf from the different folders.

View 1 Replies

ActionScript 3.0 :: Loading Assets And Storing In Corresponding Arrays

Jul 8, 2009

Currently working on a project where I have to load in a ton of images and store them in corresponding arrays. The images are listed in seperate xml files bus.xml, car.xml, train.xml. The structure of the 3 files is the same e.g.
<images>
<image>car01.gif</image>
<image>car02.gif</image>
<image>car03.gif</image>
</images>

Now inside of the main class I have arrays for the images.
var busArray:Array;
var carArray:Array;
var trainArray:Array;

How would I create a function to recursively read each XML file and load the images into the array. I only want to create one Loader class. The bit that confuses me is how do I do the loop to load each file and once its loaded one file move onto the next until all the files from that XML file are loaded.

I thought it might be something like this,
var loader:Loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.CO MPLETE, imageLoaded);
for(i = 0; i < xmlFileLength; i++) {
loader.load(new URLRequest("car01.gif"));
} private function imageLoaded(e:Event) {
//add image to its array
//move onto next image
}

What I am thinking I need is a Flag of some sort to say the previous image is loaded. Move onto the next, but not sure how to structure it.

View 3 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

Professional :: Methods Used For Loading External Swfs And Assets?

Jun 29, 2010

My client wants to take all the Flash games on their website and put them on a portable device that's not connected to the internet. I need to make sure that the swfs are completely self contained, in that they do not require the internet to load any swfs or other assets. The client does not have any of the fla's, so my plan is to download the swf and decompile it with Sothink, and then search the AS for these methods:

URLRequest
loadMovie
loadMovieNum
 
If the search returns results then I'll assume the game is loading something and that game will not be used. The client doesn't want to put any development time into this, so it either goes on the portable as is or not at all.

View 6 Replies

ActionScript :: Loading Assets From Password Protected Directory Using PHP?

Jul 19, 2011

without having to hardcode a username / password in my .swf file (very easy to decompile!), is it possible to send a URLRequest for some file (perhaps .php?) to a loader object which can load assets that reside in password protected directories?my PHP skills are weak at best, so if calling a .php script is the solution.

View 2 Replies

ActionScript 3.0 :: Loading Some Sort Of File As A Container For Assets?

May 20, 2010

This is sort of a repost, but because this thread is in the AS3 section the subject is inherently different because this board doesn't have anything to do with Flex.So, I want to put a bunch of assets within one file (SWF maybe) and load it at runtime. Then I want to be able to access these assets after I've loaded the file.As is visible by my previous thread, I have no idea where to begin, but I know it's "absolutely" possible and obviously very useful.

Even if the loaded file isn't an SWF file, I'm fine with it. I would prefer to be able to store vector graphics in it though, maybe even produced in CS3/4/5 (because that's what my friend's using to draw said graphics).Looking forward to hearing from some of you over here--now that the thread has a more general subject.

View 0 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 :: Executing Code Before Loading Embedded Assets?

May 27, 2011

Is there a way to execute code (like a preloader) before loading the embedded assets? I'm using the [embed] tag with CS5, and I'd like to avoid using an external preloader.

View 9 Replies

ActionScript 3.0 :: Loading External Assets - Making Them Reusable

Aug 13, 2008

I've been using a fairly un-dynamic approach in AS3 as until now when it comes to loading assets, but now I'll be trying to adapting a current project to fit other clients with different needs which means I'll have to grab the bull by the horns. I have an XML with a list of images that will be used, which is reused multiple times in each project. So I'm wondering if there's a way to load an image using the loader-class, and making it reusable? Being able to attach said asset later to a placeholder inside a movieclip I have stored in the library would be ideal.

I managed to load it into a movieclip but duplicating it from there on was a bit of a headache, using an approach similar to this would be great(but I have personally no idea of how to implement it): [URL] Here's the current code I'm using, in case it helps understanding what I'm after(it's most likely really ugly compared to what you SHOULD be doing in as3):

[Code]...

View 3 Replies

ActionScript 3.0 :: Loading External Assets + Multiple ApplicationDomains?

Sep 17, 2010

This is a follow-up to another thread that is getting wordy and unfocused:

[URL]

I am trying to load an external library .swf to use its embedded fonts, much like this method:

[URL]

However, the swf that is loading the font swf is loaded within a wrapper swf, and is defined as a separate ApplicationDomain as the wrapper.

Wrapper swf (app domain 1) <--- Player swf (app domain 2) <--- font library swf

The font is loading fine, and I'm even able to retrieve the font name (so I'm able to reference the object), but it is *not* showing up in the textfield as it should be.

When I remove the ApplicationDomain issue between wrapper and player swf by testing the player swf locally in the IDE (*not* loaded through the wrapper), it works fine. But I'm not sure how or why this is, because like I said, I'm able to get the font name so I'm able to reference it, it seems.

The TextField is being set to embedFonts, the font is loading, everything else seems to be working 100%, but there's some issue between the application domains that I just *can't* figure out.

View 14 Replies

Flash :: Smoothly Play FLV Video While Loading Assets In The Background?

Dec 8, 2010

Working on a 'video heavy' Flash site that has an intro video. While the intro video is playing, assets(images,flv files) should be loaded in the background. The problem is that, while the assets are loading, the intro video play gets jittery. What can I do to make the video playing smoothly while still loading assets? It might be the single threaded nature of actionscript, not sure. After using @Demian Brecht suggested method, I noticed that the culprit might be Memory allocation. As the FLVs load the memory usage goes up by ~266MB and while the videos are written to memory, the framerate drops to 1FPS.

[Code]....

View 2 Replies

Android :: Flash Builder - Loading Assets For Mobile Devices

Oct 18, 2011

I am using flash builder to make an app for android/ios. How would you recommend I use assets such as images and sounds. Should I embed them or use loader? Any benefits to each one. I have a fair amount of assets.

View 2 Replies

Professional :: Play An Intro Video Smoothly While Loading Assets In The Background?

Dec 10, 2010

For the current site I'm working on, I need to display an intro video while other ssets(mostly flv files)load in the background.The issue is the framerate drops from ~30 to about ~1 because of the loading. When the videos loadinto memory, it grows by about 266MB~ and until it's 'written' the framerate drops.Is there any workaround/solution that will allow me to play an intro video while the assets load intomemory ?

View 3 Replies

ActionScript 3.0 :: Optimize Flash For Loading External Assets (videos/pictures)?

May 17, 2010

I'm loading a lot of external videos and pictures and I'm wondering what is the best way for handling the loaded videos and images. Should I unload them after they have finished playing and reload them whenever they are needed, or it's not required since they just use the clients memory and not the cpu cycles when inactive?

View 2 Replies

Collect All External Assets?

Mar 25, 2011

Is there any way to collect all external assets (images, videos, etc) and put them in one selected folder?

View 2 Replies

How To Get XML Library Assets Back Into New FLA

Dec 15, 2010

I started using Flash CS5. I spent many hours working on a .FLA file. Saving as I went and at one point Flash CS5 crashed during the save. The .fla file is now corrupt. The new .fla format is essentially a .zip file. So I was able to change the file name to *.zip and explore inside of it. The DOMDocument.xml file is corrupt and dead. The DOMDocument.xml is the timeline so all my placement and animation is gone. However, my LIBRARY folder is in tact and has all of my library items as *.xml files. How I can get those library items into another .fla file so I don't lose ALL my work? I've tried creating a new .fla file and dragging the LIBRARY folder into the new .fla, but my library items don't show up when I load the new .fla in the Flash CS5 IDE.

View 2 Replies

ActionScript 3.0 :: Packaging Assets In A SWC?

Jan 27, 2009

i am currently working on a project that would be greatly advanced if i can find out how to package a number of assets into a SWC file so i can use it as a theme pack.I have looked everywhere on the web and in a large number of books i have sitting in front of me and cant find out how to do it.

I want to put a bunch of images and movieclips into a SWC file and then retreive the swc dynamically at run time, however i do not know how to access indiviual assets within how to load an SWC and then gain acces to its assets?

View 4 Replies

ActionScript 3.0 :: Get SWC Assets With Children?

May 18, 2011

How do I publish and import a SWC in a way that allows me to access the exported symbols as well as their children? working on an action script project in Flash Builder 4. In my SWC I have a sprite called SP_ViewHome. That sprite has a child called mcContent which is another sprite instance.I've included the SWC so that the FB4 recognizes the class SP_ViewHome (and auto completes when I create references to them). But my problem is that I can't access it's child by using the regular syntax for accessing children (compiler error 1119: "Access of possibly undefined property mcContent through a reference with static type flash.display:Sprite")

Code:
public class ViewHome extends Sprite
{
private var s:Sprite;[code]....

I can access that child with the getChildByName() function. However this seems inefficient both in terms of development and run time performance.I need to do to be able to access children of SWC classes more easily?

View 1 Replies

Protect External Assets, XML On CD?

Oct 1, 2009

I'm developing some elearning material to be distributed on CD. The main swf loads text, images, sounds via an XML file. protecting the assets/XML from being edited/stolen?

View 3 Replies

Assets :: One Big Image For Them All, Or Many Separate Ones?

Mar 28, 2010

I'm now writing a simple socket application for my own learning purposes. It will be a really simple BlackJack application.I was thinking for ways to manage 52 different cards in my app. I could make those 52 cards, as 52 images and then, maybe load them into movieclips at runtime. Or, I could take one big image with all of the cards on it, and create a masked movieclip, and then, shift and slide the image's position, so that the correct graphic of the card shows.y question is: which way is faster? Will flash be better with handling 52 small images, lets say 20x40 (in reality, i will only load like 6 of them in the display list, since black jack almost never deals with huge amount of cards). Or would it be faster, if I had a big image with all the cards (~160x160 maybe) and just reused that with different masking, calculated on runtime?

View 1 Replies

ActionScript 3.0 :: Assets Of External Swf?

Feb 12, 2009

i am loading an external swf and need to access the assets within it heres my basic code:i can access fine through the onComplete function of the loader but cannot access from anywhere else....

Code:
stop();
import flash.net.URLRequest;
import flash.display.Loader;
import flash.events.Event;

[code]...

View 1 Replies

ActionScript 3.0 :: SWC With Embedded Assets?

Jan 27, 2010

I used to be able to create distributable components in AS2 (swc files) containing class code and assets (movieclips). And it used to be really easy.Now I am struggling with Flash CS4 and AS3 and all my attempts were frustrating, as no matter what I try it simply doesn't work. I am starting to assume that maybe it is not possible anymore to do in AS3? Maybe this kind of thing is deprecated in Flash now???

Let's see what I have tried:

1) I started with a new FLA and named it 'MyComponent.FLA'. Then I drawed a green square, converted it to a mc and named it as 'MySquare'. Then I tagged 'Export for ActionScript' and 'Export in Frame 1'. Then I named the class as 'MySquare' and set the base class to 'flash.display.MovieClip'. This is my asset (a green square movieclip).

2) Created an empty movieclip and dragged the asset within it. Then I named it as 'MyComponent'. Then I tagged 'Export for ActionScript' and 'Export in Frame 1'. Then I named the class as 'MyComponent' and set the base class to 'flash.display.MovieClip'.

3) Right-clicked it in the library and chose 'Component Definition'. Then in class field I typed 'MyComponent' and tagged 'Display in Components Panel'.

4) Crated a new AS file, called it 'MyComponent.AS' and typed the following code:

Code:
package {
import flash.display.MovieClip;
public class MyComponent extends MovieClip

[code]....

5) Back to 'MyComponent.FLA', right-clicked the 'MyComponent' object in the library and chose 'Export SWC file'. That was ok, no warnings, no errors. Then I just copied this new SWC to my components folder.

6) Created a new FLA and named it 'test.FLA'.

7) Reloaded the components panel, and my new component showed up. Then I dragged it into library.

8) Then I type the following code:

Code:
var test:MyComponent = new MyComponent();
trace (test.visible)

9) I ran the new app and it was ok, no errors and no warnings. The trace statement spit out 'true' what means that the new class is really there, but... I cannot see the green square. But when I click onto the 'MyComponent' in the library, the preview shows up the green square, what means that it IS THERE in the component. So, why it doesn't show up in the stage after the class be intantiated?

View 4 Replies

ActionScript 3.0 :: Preloading The Site Assets?

Aug 28, 2009

we all know how the Loader class works, and it is definately a god send.my flex project uses external swfs as assets (buttons, pages, etc).now the problem is that because these assets are loaded after initial application creation, it is sometimes visible to the viewer that these assets are being loaded, (buttons appearing slowly etc).i need to be able to include the loading of all the assets during initial site startup. is there a way to get all the assets into the viewers cache before the site has finished loading?

View 2 Replies

Editable Assets Within A Swc-based Component

Nov 5, 2009

I created several swc-based components with AS3 and Flash CS4 extending the UIComponent structure. After exporting a fla-based component to a swc-file i created a flash-extension with the Adobe Extension Manager and installed the component.This swc-based component works fine and shows up in the component panel, but i'm not able to edit the components assets because they don't show up in the library anymore.Can someone please tell me if there's a way to export the components assets respectively the components symbols with the swc-file in order make them editable and show up in the library of the FLA which's using the component?

View 1 Replies







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