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


Similar Posts:


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

Flash :: Error Referencing Externally Loaded SWF

Mar 9, 2010

I'm loading an swf say "test.swf" which gets loaded in imageLoader , so I can get its content by :

imageLoader.content

So if I wanted one of the movieClips inside it I would do this :

imageLoader.content.testMovie.transform.colorTransform = someTransformation;

But when I do this, since the movie is not loaded the file is not compiled and gives me an error your referring to something that is not there. How else am I supposed to reference a content that will be loaded later?

View 2 Replies

ActionScript 2.0 :: Preloading Flashvars - Ensure That All The Content Being Loaded Externally Is Loaded Before The Transition Plays?

Aug 30, 2005

I am in the process of building a site for an Architect... Jamie Fobert Architects (projects) I am useing transitions between the projects and am loading details/text and images externally through flashvars, php and a mySQL database. Within my transitions I have a a preloader on the forst 2 frames the code is as follows (taken from a Voetsjoeba tutorial):

[Code]....

This works pretty well if the content is within the .swf, but when it is loaded externally it doesnt preload it at all. Does anyone know how I can adapt/improve this preloader? or somehow ensure that all the content being loaded externally is loaded before the transition plays?

View 2 Replies

ActionScript 3.0 :: Externally Loaded Swf Content Is Not A MovieClip?

Mar 3, 2011

I have multiple SWFs published with Flash CS5, all of them seemed to work fine and I could load them at runtime from another SWF and access the the loader.content as a MovieCLip and therefore access the children of those SWFs.

But now I've created a new SWF and the loader.content type is .MainTimeline__Preloader__ instead of MovieClip on this particular swf! So I get the reference error 1069 property not found when I load and try to access children in this SWF.

View 4 Replies

Flash :: Utility To Create Static SWF From SWF With Externally Loaded Content?

Dec 17, 2010

For example, If I have a SWF that loads XML and images, and displays them, is there some kind of 3rd-party tool that will take this SWF and re-render it as if all the text and images were embedded and not external? So I could just use the same SWF without it relying on image and xml data files?

View 1 Replies

ActionScript 2.0 :: Making Externally Loaded Content Of Movie Clips Persistent?

Aug 3, 2009

I'm making a very simple cross-fading slide show of JPEGs loaded from a folder. I'm loading them into movie clips with:

Code:
holder1_mc.loadMovie("images/home_flash/image1.jpg");
holder2_mc.loadMovie("images/home_flash/image2.jpg");

[code]....

View 2 Replies

ActionScript 3.0 :: Accessing Buttons On Externally Loaded SWF

Feb 22, 2012

I have loaded an external swf into loaderTopBanner. It works to manipulate that, but not the individual buttons within it. (e.g. btn_Home, btn_Info)
loaderTopBanner.btn_Home.alpha = 0;

View 2 Replies

ActionScript 2.0 :: Movieclip Blocking Buttons On Externally Loaded Swf?

Dec 14, 2009

Im designing a site with accessible controls, and the best way for me to do this is load each external swf into a container movieclip that then has all the controls applied to it.This container movie then also has another layer above with a movieclip on top of that acting as a filter layer to invert the colours. This is controlled by a keyboard press.Now when I run my project with this filter layer movieclip it prevents me from mouse clicking on any of the buttons in the externally loaded swf, without it they work fine.Is there any way that I can get through this movieclip so I can mouse click / rollover those buttons?

View 1 Replies

ActionScript 2.0 :: Externally Loaded Swf Slows Rollover Buttons?

Mar 30, 2006

I beginning to create a portfolio online. I have a pretty standard setup so far. I have a main swf which loads external swfs. One of my externally loaded swfs loads another external swf. When it does, my rollover animated buttons are slow in the main.swf.

View 1 Replies

ActionScript 1/2 :: Buttons To Carry Out Actions On Externally Loaded Movie?

Jan 29, 2007

I have a player which I have created with play/pause, rewind,forward buttons, and a progress bar on it. How can I link these buttons to carry out actions on an externally loaded movie?I have searched on the forum and can only find answers for buttons for embedded movies.

View 4 Replies

ActionScript 3.0 :: Dynamic Text In Externally Loaded Swf?

Mar 23, 2011

i have a dynamic text field in an externally loaded swf. Its a digital clock so i want the numbers to update in the dynamic text field.this is not my exact code but it is very similar. i show below that i add the loader.swf, and once its loading is complete, i can work on its movieclips and add event listeners to its buttons, etc. but i cannot change the dynamic text field (its "classic text" set to "dynamic text"). after running this, the text just stays empty as it is in the external swf).here is the sample code:-
 
var loader:Loader = new Loader();
loader.load(new URLRequest("loader.swf"));
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loaded);

[Code]....

View 5 Replies

AS3 :: Xml - Flash Generating Dynamic Buttons And Referencing Associated Data On Click?

Nov 17, 2011

ther am having problems with my flash code.I have an xml file with the following structure:

<buttons>
<button>
<id>Garden</id>

[code].....

View 1 Replies

Actionscript 3 :: Dynamically Created Buttons Are Not Working Externally Loaded Swf Files?

Aug 4, 2010

i have a swf file which is a framework file done in puremvc and i m loading multiple swf files. one of the swf file loaded into the main swf file loads multiple sub swf files in it. works fine but in the loaded swf file which loads multiple swf files in it.. button dosent work at all. i m not able to click on any button. i m jst making a tree structure so can be easily understood..

container swf -> external swf -> miniSwf file and in miniSwf dynamic button are not clickable but they have all the Mouse eventListeners.

View 1 Replies

ActionScript 3.0 :: Scrolling Externally Loaded Dynamic Text

Apr 7, 2010

I have a dynamic text field within my site that I want to load in text from an external .txt file. I also want to add a scrollbar to this field so that you can have more text than can fit in the textbox at anyone time. I have found this AS3 code to load the external text (from my 'vacancies.txt' file) in to my text box (vacanciesbox_txt):

Code:
var my_req:URLRequest = new URLRequest("vacancies.txt");
var my_loader:URLLoader = new URLLoader();
my_loader.addEventListener(Event.COMPLETE, loadText);
my_loader.load(my_req);
function loadText(event:Event):void{
vacanciesbox_txt.text = my_loader.data;
}

This all works fine and the text is loaded in as I want - The problem I have is that when I add a UIscrollbar to the dynamic text field from the flash components, it doesn't display and/or work when published.

View 2 Replies

Actionscript 3 :: Move The Externally Loaded Content Of A MovieClip To Another MovieClip?

Jul 25, 2011

I load an image into a MovieClip. At a second time I want to move this image to another MovieClip.

View 1 Replies

ActionScript 2.0 :: Dynamic Buttons And Their Content?

May 1, 2009

I have a solution for this already, but it involves a million if/else statements so I was wondering if there's a way around this. Here we go.I'm making an RSS reader that displays posts in Craigslist. All the info I need is loaded into flash and immediately tossed into arrays. Well take the links[] array for our example.

I count the amount of links
for(i=0;i<links.length;i++){
and I make my boxes to hold the info

[code]......

View 2 Replies

ActionScript 2.0 :: Linking Dynamic Buttons To The Content

Jun 14, 2007

If I make buttons using....

[Code]...

I have the button tracing "this.digit" which is the number assigned to each button, can't make it link to the content. Do i need to "push" the number to an array...or similar?

View 1 Replies

ActionScript 3.0 :: Created A Dynamic Text Box And Have Xml Content Loaded?

May 12, 2010

I have created a dynamic text box and have xml content loaded into via a for loop. I would like for each item in the list to be clickable and fire off a different function.

[Code]...

View 3 Replies

ActionScript 1/2 :: XML Loaded Content Not Working With Html Dynamic Text Field?

Aug 18, 2009

I'm trying to load an XML file and place the content into a dynamic text field.  The XML nodes contain content within CDATA sections that have basic <b> and <i> tags.  Once I have the content loaded into a variable and trace it, I can see all my tags within.

I then place the content into a dynamic text field with html set to true but for some reason it doesn't show any formatting, the tags appear to have been rendered because they don't show up inline.  I thought maybe this was due to embedded fonts but i have all of my bold, bold italic, italic and regular font's within a text field embedded so I wouldn't think thats an issue.  Is there something I'm overlooking?

View 6 Replies

Actionscript 3 :: Make The Actual Stage Dynamic To The Content Loaded In The Flash File?

Nov 9, 2011

I was wondering if there is a way to make the actual stage dynamic to the content loaded in the flash file.

Firstly the method I am using is importing a external swf to the stage into a container called container. The main stage, lets call it index, is still on default size, and I want this to expand dynamically as content is loaded in. page1 may be 900px width, page2 may be 500px width, and as I load the content the index stage should expand the width to that of the page loaded. Some steps I have tried but did not work.

if page1 button is pressed stage.stageHeight = 900; - not working (how do I set stage size in as3)made a movieclip in page 1 spanning the page size and called it p1_stage so I can reference the data from there. trace(container.p1_stage.height); gives this error: TypeError: Error #1010: A term is undefined and has no properties. at index_fla::MainTimeline/frame1()

View 3 Replies

ActionScript 2.0 :: Dynamic Loaded Buttons Won't Work

May 15, 2010

I try to make a dynamicly loaded menu.I load four buttons to the stage and applie code to each of the buttons. But it's only the last button loaded, that responds to onRollOver/onRollOut If I roll over the other buttons it's the last buttons that reacts all the time.I just can't see what's wrong. Here's the code:

Code:

buttonCount = 4;
for (var i:Number = 0; i<buttonCount; i++) {
btnRef = "button"+i;

[code]....

View 1 Replies

ActionScript 2.0 :: Dynamic Loaded Images As Buttons?

Jun 16, 2005

loaded images dynamiclly in my flash movie and now i want to make them behave like buttons. I mean, I want [onRelease] function to work. I am sure i am doing something wrong because i cannot make it work.

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

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 2.0 :: Externally Loaded Swf Does Not Stay Loaded?

Feb 16, 2006

I am loading an externally loaded swf that uses a mask to transition in. When the user clicks a different button I am doing a gotoAndPlay that goes to a mask that "unloads" the content (it doesnt actually unload the info is just outside of the mask area. As soon As I jump to that section the movie is no longer loaded and just shows the container clip that I had created for it. The Container Clip is never changed and is the same throughout the whole process. The only thing that changes is the mask animation.I have tried both loadClip and loadMovie but no luck on keeping the clip loaded.

EDIT - I have narrowed it down. When I change the mask movieclip the movie unloads for some reason. Is there a way I can keep it loaded?

View 2 Replies

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

ActionScript 3.0 :: Remove The Loader But Its Content Still Playing I Know That From The Sound Of The Content Was Loaded?

Apr 20, 2009

How to remove a loader and its content using removeChild or any other way, I had removed the loader but its content still playing in the background i know that from the sound of the content.this is the my code for removing:

removeChild(getChildByName("SampleLoader"));

View 9 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 :: 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







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