ActionScript 3.0 :: Reusing External Loaded Resources
Feb 17, 2011
I need to load an external resource and be able to reuse it (create new objects based on that resource). I need to create multiple objects using that resource and I don't want to load it again over and over every time I need to use it. My question is: How can I load a resource (in my case, it's a collada file ".dae") once and be able to reuse it again?
View 1 Replies
Similar Posts:
Jul 8, 2010
Suppose you have a slideshow movie that loads content such as images or Flash movies itself and continually replaces content with new images or movies as a viewer browses through content. Is there a way to store images or movies that have been loaded so that if the same content is selected they do not have to downloaded again? Presumably once content has been unloaded or something has ben loaded into the same level the data is wiped from memory and has to be downloaded if it is displayed again. How could content be stored in Flash or does the content stored in the browser cache take care of this?
View 1 Replies
Sep 11, 2010
This is sort of a two part question. I'm building a flash image viewer to be a portable age-restricted module (violent video games). Basically, it will load any number of images from a CDN and require the user to enter their birthday before viewing it. Simple stuff. The problem is that, per company policy, we can't allow those images to be directly accessible by any means of sniffing (eg, watching your Resources/Net tab in Webkit/Firebug, or watching XHR if we loaded them that way). So, I'd like to get your opinions about the best way to approach this.
At first I thought to have a server-side script that loads the image (eg via PHP) by passing a var that can be decrypted but with a dynamic salt, eg, using a method that is very unlikely to be discovered (for example, having the salt be embedded throughout the string), but that defeats the purpose of the CDN as all requests would be geolocated to the server.
Then I thought that loading the images via sockets would be a good solution, however, I'm having trouble converting the binary image (after removing the response headers) to a Bitmap.Is there a better way to go about this? I know that realistically it's impossible to completely prevent the content from being linked to (eg someone could screenshot the flash) but my goal is just to take steps on our side to prevent that from happening by native means. Below is the socket code (irrelevant parts removed), if that helps any.
package com.std.socket {
import flash.system.Security;
import flash.net.Socket;
import flash.events.*;
[code]....
As I'm writing I'm thinking that in SocketRequest::evt_socketResponse(), the this.sock.readUTFBytes() bit should really be:
this.request.response_parts.push(this.sock.readBytes(this.data, this.data.length, evt.bytesLoaded));
and then remove the headers from this.data, but TBH I'm not super ByteArray-savvy.
View 1 Replies
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
Jan 16, 2011
Is there a way to load graphics externally when in development but package the graphics into the project's swf when it is published?
View 1 Replies
Mar 8, 2011
Under Visual Studio 2010, I'm developing an asp.net application.I added a folder to my project called Flash. Under Flash folder I added a swf file with its external resources to run. The folder content:
1- ScrollingImages.swf file to lunch the flash
2- ScrollingImages.xml file that the swf file uses to read images from thumbnails folder
3-thumbnails folder which content images used by swf file. I can embed the swf file to html easily using this code:
[Code]...
View 1 Replies
Aug 11, 2004
I'm currently doing a script in which I have to preload some external resources (jpgs) at the begining of the animation.I dynamicaly create my MCs in which I do my loadmovies. Classical.Now the thing is, a few frames later, I need to reuse the images I have preloaded in other MCs.The thing is there seems to be a problem in using dynamicaly created MCs, here is why this is weird :
- I import a MC from the library : I can duplicate it, and I *see* it on the animation
- the MC that I have created, that I *see* on the animation, doesn't want to be duplicated : by that I mean that when I duplicate it, it can't be seen.
Now if there is a simple explanation for that, I have another question : I have an empty MC in which I want to *copy* one of the very MCs that I have dynamicaly created at the beginingn what is the best method ? attachMovie ? doesn't seem to work, but yet again, all this might be related.
View 2 Replies
Apr 14, 2009
I am having a real problem with understanding something in flash - it doesn't work in the way I expect so I figure I have really misunderstood something.What I want:I am creating a bunch of .swf files and in each one I want multiple instances of an object that when you put the mouse over it the object will play its animation a bit and pop up a tool tip. Each object can look different (i.e. be a different bitmap) and animate differently (shake, pop, rotate etc).What I did:I have tried to create a class (myMouseItem) that creates the necessary listeners to handle the animation and pop up the tool tip.
I create a library item and attach it to the myMouseItem class. I can then put one instance of this inside my .fla and it works. (I still seem to have to put a .stop() in the actionscript for the scene to get it to stop animating for ever but I can probably live with that)What I can't figure out:How do I repeat this with multiple objects all with different bitmaps but reusing the underlying class? When I try to add another instance of my library class and edit the bmp it changes all instances. When I try to create another library item with the same underlying base class I get an error saying that I have to choose a unique identifier, so I don't seem to be able to reuse my .as file.
View 2 Replies
Mar 1, 2011
I am trying to reduce the size of my swf, and I see that I am using a movieclip on each frame on the Timeline, which has to be adding considerable size to my file, since I have placed the movieclip(animation) on every frame. How could I do this more efficiently and still acchieve animation between each frame? I have included a ripped version of the fla. , since the attachment limit here is pretty low. In the file the video - files and the picture files have been removed, but the rotate... mc's(animation) are placed in the interanim Layer and the Menustate Layer, on each frame.
View 1 Replies
Apr 15, 2009
Code:
var slideNo:Number;
slideNo = 0;
var xmlLoader:URLLoader = new URLLoader();
xmlLoader.addEventListener(Event.COMPLETE, showXML);
[code]....
View 3 Replies
Jun 21, 2009
I am doing a web portfolio with thumbnail buttons that change the pictures. What is the best way to avoid having to make a new button for each new picture thumbnail? So resusing the button but changing the thumbnail picture in it and what picture it links to? Using CS4.
View 1 Replies
Feb 25, 2010
Suppose I want to load a .jpg from the server ONCE and then I want to reuse it a dozen times in my .swf... How can I achieve this without adding to the .swf`s file size? I was thinking copying its BitmapData a dozen times, but that adds to the file size, right?
View 2 Replies
Aug 31, 2011
I am making a mobile application in as3. I'm optimizing.I have a scroll containing 30 objects (buttons). All buttons are the same except its title.This bucle is inside the container scroll:
for(var a:int=0; a<global.get_A.get_B.length; a++)
{
b = new ItemList(global.get_A.get_B[a]);[code].....
View 1 Replies
May 18, 2009
Out of some curiosity and the use of possible standard key variables so I don't have to create several instances to the same class, I was trying the following:
[Code]...
My question is: Is there a better approach to this on AS3? Something tells me I'm just heading the wrong way there...
View 4 Replies
Apr 2, 2009
I'm doing a filmstrip animation and each frame of the strip has a small pic on it and using TweenLite, I'm making it expand and contract on mouse rollover and rollout. That's not the problem. Since it's basically the same function, I don't want to have to write it for all 16 frames. I thought I'd try 'this' but that doesn't work on AS3. So I'm trying to find a solution that does. Here's my code (for one frame of the movie....in this case, the eighth).:
import gs.TweenLite;
fsAnim.filmstrip_mc.photo8_mc.addEventListener(Mou seEvent.MOUSE_OVER, photoOver);
fsAnim.filmstrip_mc.photo8_mc.addEventListener(Mou seEvent.MOUSE_OUT, photoOut);
function photoOver(evt:MouseEvent):void {
[Code].....
View 3 Replies
Jun 28, 2011
I'm creating a pacman game and basically I'm having trouble coding the enemies (ghosts), the code works perfectly with just one ghost, as soon as I add another it starts to go wrong.Firstly I've got this function which places the enemies:
Code:
//places the enemies
function placeEnemies() {
[code].....
View 2 Replies
Apr 17, 2009
if I have two scenes and on scene 1 I have some code with variables and event listeners in it and I copy that code into Scene 2. When I test the movie I get a duplicate function definition error because the variables/event listeners on both scene 1 and 2 have the same names. To fix this I could just change the names of the variables and event listeners in scene 2 to a different name but what if I have say 10 or 20 scenes then I would need to change the names of all of them on every frame and I don't want to do that.Is there a way of using the same variables/event listeners on different scenes without having to rename them and without getting the duplicate function definition error.
View 21 Replies
Jun 19, 2009
I'd like a movie clip called "following_cursor_mc" to follow the cursor, regardless of which of several different frames the playhead may be on. I've reproduced the code below on each frame in which I would like the cursor to be followed by "following_cursor_mc" but these errors are thrown for each of the frames:
1021: Duplicate function definition.
View 7 Replies
Feb 4, 2010
I am trying to reuse the lines of code and it worked fine the first time but when I tried to use the evtObj.target.name it gave me error 1120:Access undefined property evtObj.Here is the code I tried to use:When I test the movies it just runs automatically instaed of waiting for the click.
View 4 Replies
May 23, 2010
If I use an empty movie clip to load a series of images into,how do I get them to load in the center?The images are all different sizes.I think this is fine, if they loaded with the center of both the target clip and the image aligning.Upper left registration point for the target is not good.
View 10 Replies
May 2, 2011
i was in situation that tree is re-using my custom item-renderer.. is there any method or way around we can stop tree to reuse.. and always create a new item-renderer for new item..
View 1 Replies
Jun 6, 2011
I want to be able to reuse my existing controller logic regardless of whether a request has been sent from a Flex client (using BlazeDS + Spring at the backend), or as a simple HTTP POST/GET request. For simple cases, things work OK, however, there are some occasions when I need to access some session attributes. At first, I almost exclusively used the FlexContext class, but then I realized that when one sends an HTTP request, then the Flex Context is obviously undefined.
My question is, what is the best approach to abstract the session extraction logic,regardless of the type of the request. In other words, I would make a class called SessionManager, which has a method getSession. This class will make a check whether there is a Flex context, if there is, it will return the session of that context. If not, it will simply return the current HTTP session (which I assume is the same as the Flex client session, but I was not sure)
View 1 Replies
Sep 11, 2009
I somehow am able to write bits of code but am still learning how to restructure code so that it is more efficient.I have 15 buttons. Each one, when rolled over, should change the color of 2 movieclips underneath it (and when rolled out, should change back). I have the below code so far but I don't think I have to re-write the functions each time. How do I "re-use" the function code (or, only write the function code once), but specify what movieclips the function should be applied to? These are just 2 of the buttons of the 15:
Code:
menu_mc.invis1.addEventListener(MouseEvent.MOUSE_OVER, changeColor);
menu_mc.invis1.addEventListener(MouseEvent.MOUSE_OUT, changeBack);
function changeColor(event:MouseEvent):void[code].................
View 9 Replies
Aug 15, 2011
[URL]I have: main.swf (a menu) and I have module.swf (content)If you navigate to Subsea Wellhead Systems/SS-15 BigBore II and click on that I have it load an external swf which covers most of the parent. So far so good. My problem is unloading the loaded 'Child' swf with the button provided on the loaded 'Child' swf.below is the code I used to load the file but I cant, for the life of me, find a way to unload it.
var bigboreLoader:Loader = new Loader();btnbb2.addEventListener(MouseEvent.MOUSE_UP, bigborecontent);
function bigborecontent(event:MouseEvent):void{var bigboreRequest:URLRequest = new URLRequest("moduletemplate.swf"); bigboreLoader.load(bigboreRequest); stage.addChild(bigboreLoader);
I am certain it requires the Child to communicate with the parent somehow but I am at a loss. If I could get a bit of advice or a link to something deal with this, it would be a big help. I just need to have my links load my modules and the remove them when the close buttong is hit on the loaded swf. I promise I have done searches and I admit I have found asnwers but still they are not working. I found the code below:
Main FLA:
function removeF() {
removeChild(bigboreLoader);
}
[code]....
View 10 Replies
Feb 23, 2011
I spent almost a week trying to figure out how to unload a currently loaded swf using its button and loading a new swf... I have three files, a main.fla, file1.fla and file2.fla. In my main.fla, I have a code which loads the other two files. If i will click the "unload" button in the file1.swf, I would like the main.fla to unload the file1.swf and load the other file, file2.swf. Here is the code to load the file1.swf:
[Code]....
View 1 Replies
May 25, 2011
I have a datagrid in a flash app. The intial use works fine. The flash has the ability to recalculate the needed data which I then use to repopulate the existing datagrid. What is the best way to clear out a datagrid and repopulate it?I tried:ifxGrid.dataProvider.removeAll();but it does not clear out the previous dataifxGrid.removeAllColumns();this worked a little but not entirely.So what's currently happening is that the new data is appended to the old data. So if I had 50 rows in the 1st calculation and then I have 70 rows in the 2nd calculation I end up with 120 rows of data in my datagrid.
View 3 Replies
Feb 9, 2010
I have a List component using multiple item renderers determined by the itemRendererFunction. When I set the data the first time, it works as expected. Then, when I set the data a second time with new data, it doesn't call the itemRendererFunction and tries to reuse the current renderers even though they don't match the data.Once I scroll, the function is called and the correct renderers are used. I tried calling invalidateDisplayList and such prior to setting the data, but that didn't fix the problem.
View 3 Replies
Aug 1, 2009
I'm putting together a project where I'm loading different images at different times. The first image loads when the app starts. After the user answers some questions, I load a different image, replacing the first. When I try to do that, I get an error:
[Code]....
View 4 Replies
Jul 24, 2009
I've got a small (more than 100 hours of thinkwork up till now!) problem I can't seem to solve:
I want to populate an external loaded swf with an dynamicly loaded xml fil (loaded from my config.xml).
[Code].....
how do I get the external xml into the external swf as a variable for the actionscript in the external loaded swf (So I just want to put the path in the script in my external swf...).
View 5 Replies
Nov 8, 2011
I have a homepage with five "links" to each swf. Now the first swf I have a custom cursor that hides the mouse. When I click on that link it plays and when I quickly go to the homepage again it hides the mouse there when it's not supposed to do it.
Same with every other link. When I was busy with the first swf and want to go to the last swf of the five, my mouse just disappears! It is almost as if it keeps on "playing" without seeing the swf...
Here is the code that I have so far!
var currentpage:uint = 0;
//one loader object per project:
var loadingobject1:Loader = new Loader();
loadingobject1.x = 445;
[Code]....
View 1 Replies