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


Similar Posts:


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

Flex :: How To Get Embedded SWF To Interact With Project Assets

Jan 13, 2011

I have a Flex project in which I am embedding a Flash SWF containing an image viewer. The SWF file I'm embedding is supplemented by an XML file, which contains a list of images to show, and an images folder containing the images. The problem I'm running into is that the embedded SWF file is unable to load the pictures. I am able to see the forward/backward navigation buttons, but there are no loaded images. When I view the SWF file outside of the Flex project it works fine. Is this because Flex isn't allowing the SWF to reach outside and access other project assets?

Here's my code for embedding the SWF:
<mx:Script>
<![CDATA[
import mx.controls.Image;
import mx.events.CloseEvent;
import mx.managers.PopUpManager;
[Code] .....

View 2 Replies

Actionscript 3 :: Clear Out Embedded Bitmap Assets In AIR?

Mar 15, 2012

I'm creating an AIR 3.0 app.

For a lot of my graphical assets I'm using the Flex embed metadata to embed bitmap objects as Classes and then instantiating them.

The problem is that it seems these never get garbage collected. I haven't found much info online but I've seen a couple of posts that seem to confirm this.

Anytime one of my classes gets instantiated that has these embedded assets, they always create new instances of the Bitmaps and BitmapDatas rather than reusing what's already in memory. This is a huge problem for memory. And I can't find any way of de-referenciong them or getting them to leave memory.

So the only solution I can think is to just load the graphics from disk rather than using the embed tag. But I'd rather not do this seeing as how when the app is packaged and installed, all of those graphcial assets will be on the end users computer rather than contained within the SWF.

View 2 Replies

Actionscript 3 :: Use Timeline Scripting On Embedded SWF Assets W/ The Flex SDK?

Sep 11, 2009

I've embedded a SWF into a class using this syntax above my class definition:

[Embed (source='/../assets/MyMovieClips.swf', symbol='SpecialMovieClip')]
public class SpecialMovieClip extends MovieClip

The MovieClip asset seems linked with my class okay, and instantiates along with it, and is visible, but:

I can't access instances placed on stage within that clip. The timeline scripting seems non-functional.

Is this the drawback of embedding SWF files at compile-time with the Flex SDK? So, maybe I should just go back to compiling with the Flash IDE if I want timeline scripting or instances positioned on-stage?

View 2 Replies

Flex :: Does Compiler Automatically Optimize Embedded PNG Assets?

Jun 29, 2010

I was trying to further reduce the filesize of a SWF file by optimizing the embedded PNG graphics (using ImageOptim tool). To my surprise, this didn't yield any effect, so I created two test Images:

Original (433883 bytes)
Optimized (273723 bytes)

When embedding either of these assets in a simple ActionScript project, the compiled SWF is ~274kb in size. Which raises the question: Does Flex optimize embedded PNG assets during compile-time? If yes, is there some documentation about the optimization going on? It can't be because of the SWF compression alone, because zipping the images doesn't reduce filesize at all.

Here's the Code for completeness:
package {
import flash.display.Sprite;
public class SizeTest extends Sprite {
[Embed("/assets/original.png")]
private var ImageAsset:Class;
public function SizeTest(){
}}}

View 2 Replies

Flex :: Asdocs Seems Unable To Find Embedded Assets?

Jul 25, 2010

I'm running asdocs from a .bat file with flex sdk 3.2.0 (I have replaced my long project root folder with PROJECTROOT):"C:Program Files (x86)AdobeFlex Builder 3sdks3.2.0inasdoc" -source-path . "C:Program Files (x86)AdobeFlex Builder 3sdks3.2.0" "_PROJECTROOT_Componentssrc" "C:\_PROJECTROOT_assets" -doc-sources .PAUSE"Unforunately, I keep getting errors similar to this:"_PROJECTROOT_assetsstyles.css(344): Error: Invalid Embed directive in stylesheet - can't resolve source 'Embed(source = "close_button.png")'.downSkin: Embed(source="close_button.png");"I really don't understand this as "close_button.png" is in the same folder as styles.css. When I build the project from within flexbuilder, it compiles it fine and does not throw any errors.

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

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

Javascript :: Gain Access To An Embedded Flash Video's Parameters That Is Embedded On A Site You Don't Own Via A Browser Extension?

Jan 2, 2011

I'd like to gain read only access to the following parameters of embedded Flash videos located on sites that I do not own through my own custom browser extension/add-on:

Time location of playback head (so I can display the current time in the browser extension via HTML5/JavaScript) Frames (so I can make capture them to an image file, save it and display image in browser extension) Original Dimensions in pixels (so I can display the original video dimensions via JS/HTML5 in browser extension)

Is this possible by using Javascript and HTML5 from a browser extension?

Would I have to use something like the SWFObject Javascript API [URL]

View 1 Replies

Flash Won't Load When Embedded But It Works On The Published Embedded Html?

Nov 11, 2009

I made a flash mp3 player and it works fine in any other test pages. but when i embed it onto my site it just shows blank. what do i do? my site is [URL] and the flash player i tested here [URL] and it plays. What im i doing wrong? i tryed everything. right now i just got it in a iframe but i dont want that iframe.

View 1 Replies

ActionScript 3.0 :: Value When The Text Is Dynamically Embedded And Correct When Manually Embedded?

Oct 19, 2007

Looking at the attached file, why does bottomScrollV give me the wrong value when the text is dynamically embedded and correct when manually embedded?

Here's the code:
ActionScript Code:
var loader:URLLoader = new URLLoader();
loader.addEventListener(Event.COMPLETE, onLoad);
loader.load( new URLRequest("info.xml") );

[Code]...

View 1 Replies

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

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

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

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.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

Professional :: XML Error After Importing AI Assets (CS5)

Jul 2, 2010

In an existing Flash (CS5) project NOT utilizing XML in ANY WAY, I imported (copy and pasted) a group of objects from Illustrator (CS5) into the project. When I published the file afterwards I got an XML error:
 
[Code]....
 
I even tried importing the whole flash XML package, just to see if it resolved the issue. ( import flash.xml.*; ), needless to say, it didnt. So then I deleted the imported Illustrator group and what do you know.. my Flash file compiled without any issues, no XML errors..  VERY confused.. only thing I can think of is if it has to do with placed images..
 
Right now I have resorted to importing as bitmap, but I dont like this option

View 1 Replies

ActionScript 3.0 :: Add Assets Like Buttons Etc To The Xml File?

Jul 16, 2010

I want to add assets like buttons etc to the xml file. Will that change the order in which the existing items will be called but the code?Right now it's this:
 
<image>#1.jpg</image>
<image>#2.jpg</image>
<image>#3.jpg</image>
 
It will be like this:
 
<image>#1.jpg</image>
<image>#2.jpg</image>
<image>#3.jpg</image>
<asset>#1.gif</asset><asset>#2.gif</asset><asset>#3.gif</asset>

In my opinion no change in the code should be required except for adding loaders for the new items.

View 1 Replies

Professional :: Preloader Assets Not Showing Up?

Nov 23, 2011

Greetings. I am working on a website that uses flash for everything. There is little HTML ... anyway, since it is such a massive main file, the client requires a preloader. I searched for some code and inserted it. It seems to be working fine. The only weirdness is, i can't get the "Loading Module" animation and the dynamic text box used to show loading status to show up on the stage. Instead what appears there is some kind of bizzarre animation that just uses little circles as an animation. Sounds crazy i know, but you can see it at the following link.

[Code]...

View 3 Replies

Actionscript 3 :: Export Assets From A .SWF Container?

Apr 8, 2012

Given is an online swf on Hubworld's site, which loads two configuration XMLs into an .swf file, then displays a game. A copy of the Flash with the two configuration files can be found here. [URL]. If unzipped into a folder, it loads the two XML files and displays everything correctly. The problem is, how to take it apart?

I tried decompiling the file, but it only shows up as a (mostly) empty file with a single symbol and a few misc tags inside it, despite the file itself containing several hundreds of vectors. [URL] I severly doubt that any sort of encryption or obfuscation is present, since it's a children's game and I took apart many others without a problem. How could I retrieve the said files from the container?

View 1 Replies

Flex :: ANT Tasks Can't Find My Assets?

Mar 18, 2010

I'm attempting to compile my Flex project with an ANT build script.One of my MXML components references an external XML data file, like this:

<mx:XML id="treeData" source="assets/data/help.xml" />

When I build the project using Flex Builder, it compiles fine. However, when I try to compile it using ANT, I get the following error:

Error: Problem finding external XML: assets/data/help.xml

How come ANT isn't finding the XML file? Apparently it knows the source path otherwise it would not have found the component to begin with. I added the source path to the target anyway, but it doesn't seem to have made any difference:

<source-path path-element="${SRC}" />

View 1 Replies

Actionscript :: Flex Fetching Assets From A CDN

Mar 25, 2010

My main.swf loads symbols from other swfs at runtime. If I keep all the swfs(main and others)on my server, things work fine. But if I keep all of them on a CDN, one particular symbol won't display occassionally. With flash tracer plugin for firefox I am able to see that all the symbols have been loaded and their z-indices are as they should be.

View 1 Replies







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