ActionScript 3.0 :: Return Image Array From Loader In Another Class
Nov 6, 2010
I want to load an array with images in Main.as, by using a loader in another class. The problem is, I have to wait for the images to load before returning the array. How do I return the array images[] (once it's loaded) back to characterGFX[] in Main.as? I'm just lost.
Main.as
Code:
package {
public class Main extends Sprite{
private var gfx:Gfx = new Gfx();
[code]....
View 9 Replies
Similar Posts:
May 16, 2011
I have to implement a menu with icons using actionscript only. I create a data provider from XML and set
menu = Menu.createMenu(null, dataArray, true);
menu.iconFunction = iconFunction;
Till here everything is fine and my menu is presented, but only with labels.
I create iconFunction as following:
private function iconFunction(item:Object):Class
{
var st:Loader = new Loader();
st.load(new URLRequest(item.icon));
return ?;
}
how do I return my loader object as Class?
View 2 Replies
Mar 22, 2011
[code]This script is for a loader image gallery in flash, as part of a class assignment. What happens is that in flash, when I open the swf file, the initial image (images/nair_evanescentautumn.png) will load fine. However, clicking on any thumbnail image (including the exact same images/nair_evanescentautumn.png), will result in an error saying the file cannot be found.I cannot figure out why it is doing this... I've tested it over. Clicking each thumbnail does go to the correct position in the two separate functions. All said full-size image links are in the folder images/, and replacing the initial loader image will load the other images in place of the default one. However, clicking on any thumbnail still results in URL not found, even though everything works correctly.[code]Before anyone asks why I'm putting this kind of content into a flash site, I'm not--this is only for a class assignment. I'm just trying to figure out why my images aren't loading right when I'm only doing the exact same thing in the functions as I am on the other pages.Of note, commissions.swf has the exact same feature, just with swf files loaded instead, and it works perfectly fine. home, traditional, digital, and photography all have the image gallery, and all have the same issue (I only referenced one page because if I can fix one page I should be able to fix all of them).As for the artworks, they are all my fiance's. The website design was built for her, and I used the website design for this project because I didn't want to have to build an entirely new interface design. Since the project also required a gallery, I felt that this interface would work just fine.
View 3 Replies
Feb 22, 2009
I'm making a custom class and all my get functions are working fine except the one that returns an array. Here is the code for my class (abridged to the relevant parts):
ActionScript Code:
/*
VolcanicIsland class for Polypelago
Script in progress
[Code].....
How do I get an array to return correctly? Doing trace(VI1.getData()[0]) doesn't work either.
View 1 Replies
Aug 4, 2009
I'm having some troubles with the use of interface and inheritance in AS3. I've done lots of OOP in the past and what I'm trying to do seems obvious to me, but doesn't work in AS3. The question is : Is it possible to override a function that return an Object of class A, and make it return an Object of Class B which extends A ? It seems not to be possible, since I'm getting a signature error in Flash, when compiling. For example, the following set of class do not compile (the code in function definition doesn't matter):
[Code].....
View 3 Replies
Jan 17, 2010
I'm trying to load images using the loader class but it doesn't seem to ever trigger the complete event (in this case anyway). The images are only 16x16px images from the local machine, so it should take no time at all to load. I use the totalImages variable as a counter; as an image is loaded, it subtracts 1 from it. Once it is 0, all images are loaded. I can create an instance and it goes as far as tracing "Begin loading images", but that's it. No errors in the console either.
PHP Code:
package lib{
import flash.display.Bitmap;
import flash.display.BitmapData;
import flash.display.Loader;
import flash.geom.Rectangle;
import flash.net.URLRequest;
import flash.events.Event;
public class Frame extends Bitmap{
[Code] .....
View 2 Replies
Jun 16, 2011
I'm trying to load an image in a movieclip using using the following:
Load_image_btn.addEventListener(MouseEvent.CLICK,Load_image);
function Load_image(event:MouseEvent):void{ var my_loader:Loader = new Loader(); my_loader.load(new URLRequest("C:UsersAmandaDesktoppicture1")); addChild(my_loader);}
[code].....
View 26 Replies
Oct 14, 2010
I'm trying to resize a .jpg file that I'm loading in the loader class, and I can't get it to work. Here's the code I'm working with. (Note: I had to cut the URL to the jpg out because the forum blocks me from posting URLs with images!)
ActionScript Code:
getURL = new URLRequest("*URL to a jpg goes here*");
// Load slide image from URL
[code].....
View 2 Replies
Aug 20, 2009
I want to load an image from altavsita into my swf with loader class.Then I get this error message.From my flashdevelop flash player everything works fine.But from all others I get:[code]
View 4 Replies
May 10, 2010
I'm trying to create a class that loads images dynamically with their corresponding thumbnails using an external XML file. It works fine in a lone fla file but when I try to make it into a class so I can reference multiple XML files, I get "A term is undefined and has no properties". Now, the class seems to work OK: I get a thumbnail displayed and when I click on it, it shows the picture but not the text and I get errors for both the xmlLoaded and showPicture functions as below. (I didn't paste the constructor function but it's there.)
It seems only one line is causing trouble in the xmlLoaded function (see asterisks) while multiple lines in showPicture are problematic. I know how to use the debugger to find the line of code but how do I wade through all the parameters to figure out what the problem is?
Code:
private var _imgText:TextField = new TextField();
private var _imgLoader:Loader = new Loader();
private var _containIt:Sprite = new Sprite();
[Code].....
View 2 Replies
May 27, 2011
Using ActionScript can I do with my game, which is running in a browser, verify that the user already has the files needed to run the game installed on your computer? If he had these files do not need anything else that was born and can play the game immediately. If he did not have the files, they would be loaded so that the browser does not erase these files. So when he returned to play the same game day after,as the files already on your computer, nothing need be loaded.How do I remove one of the main memory image that was loaded using the Loader class? I tried using the unload () method but nothing happened.
View 2 Replies
Oct 30, 2011
I'm building an Adobe Air app that needs to load external images from different webservers. I have my basic loader function set up, but I encountered one server that wouldn't let me load it's images. it gave me the following error[url]...
After that I got in contact with the server's manager and he told me he had been working on some basisc hotlink protection for his images. He also told me that I could subvert this by supplying[url]... as the referrer when building the request headers.
First of all I found no trace of hotlink protection with online testapplications for hotlink protection. Secondly I have no idea how to set up what he told me with a simple Loader class function.[code]...
View 2 Replies
Aug 12, 2009
im working on an image viewer and im loading an image to a loader and then add the loader to the stage.I want the user to be able to drag and drop the image but since it's a loader i dont know how to do it.
I tried
imageLoader.startDrag = true;
imageLoader.content.startDrag = true;
but im getting an error on both.
View 2 Replies
Jul 9, 2011
In the first frame of that movieclip, I'm importing an external swf with Loader class,(Using actionscript2 but my main flash page using Actionscript3),It is loading well but when i pass to second frame and return to the first frame again, the Loader doesn't work. (i'm using addChild(); to show external swf)
View 9 Replies
Mar 12, 2010
I want it to return a MovieClip but only after a Loader has triggered its COMPLETE Event.
like so;
Code:
static public function loadBitmap(URL:String):MovieClip {
// create MC
// create Loader
[Code].....
but it isn't fool proof because the MC is returned before the Loader finishes loading.
View 2 Replies
Aug 18, 2009
I found myself loading a new XML file every day and so decided to create a small class that will load the xml file and return it.The class is loading the file but when i try to return it to a new xml object in the document class it doesnt load it.I think that it's something to with the return being in a nested function but i tried a few ways and non seems to work.
[DOCUMENT CLASS]
loadXML:LoadXML = new LoadXML();
myXML:XML = new XML(loadXML.loadXMLFile("gallery.xml"));[code].....
View 1 Replies
Dec 13, 2007
Some images I load dynamically are too big so I would like to scale them to fit the stage.
[Code]...
this returns 0. Why does it return 0 when the image loaded is obviously much larger then 0 pixels. How do I change the width and height of imgCont to a specified dimension.
View 1 Replies
Dec 14, 2009
PHP Code:
var filePaths:Array=["thmb1.swf","thmb2.swf","thmb3.swf","thmb4.swf", "thmb5.swf", "thmb6.swf",
"thmb7.swf","thmb8.swf", "thmb9.swf", "thmb10.swf", "thmb11.swf" ];
function loadImages3(event:MouseEvent):void {
[code]....
My problem is that I can't figure out how to decouple the loader from this loadNewRow function. Ideally, I'd like to figure out how to load all the swf's give them dynamic names... like thmb1loaded, thmb2loaded, thmb3loaded.. push into an a ("loaded") array and then have that be used to build the grid.Right now, its loading them every time the loadnewrow function fires. I'm sure its a simple matter of iterating a .name within a contentloaderinfo .onComplete when each swf is loaded...
View 2 Replies
Oct 20, 2010
siteLoader.as, Line 23 1061: Call to a possibly undefined method load through a reference with static type Loader.
[Code]....
View 2 Replies
Nov 30, 2010
I have declared an Array as a new Array(); I would like to push objects into that array but have a text field read back the array minus the commas that are pushed by user interaction (from numbered buttons).
For example, if the user pushes button 1 then button 4 then button 8 I would like the array to read in the text field 148 instead of 1,4,8 .
View 7 Replies
Oct 26, 2011
How would I make an image I load using AS3's loader class into a button with an event handler on it? Below is what I have started. And below that is my error I get when I click the message.
AS:
//call function that starts loading my image
callButtons();
function callButtons():void {
[code]....
the error I am getting when I click the spanish.png on the stage is: ArgumentError: Error #1063: Argument count mismatch on MyVideoPlayer_CS4_fla::MainTimeline/playSpanish(). Expected 0, got 1.I NEEDED TO ADDED evt:MouseEvent
View 1 Replies
Apr 30, 2010
I have this piece of code to change images. I was trying to figure out how you could put a timer on the code, so if the image has been displayed for say 5 seconds it diverts to the next image automatically? Also if it's not to hard, when it has played to the end to divert to the 1st image.
[Code]...
View 1 Replies
Oct 12, 2010
I am using the Loader class to load 3 external swfs: sharedTopics.swf (does not have a document class) fonts.swf (document class is FontManager) main.swf (document class is Main) The same loader is used to load all 3 assets.
[Code]...
View 2 Replies
Feb 23, 2010
I need to create a gallery to load images and display them. This part is fine:
/**
* @variable image_name to store the name of the selected item
*/
private function showimage(evt:Event):void
[Code].....
where imgMain is the id the image component.
But, I need a small twist. A transition image i.e. loading image should be displayed while the the image is being loaded.
View 1 Replies
Dec 7, 2011
[code]I want to input a number and find a match for the number, returning the values on the row in to specific fields for each number. For example, if I input the number 10 in an input field, I want the number 1.2276, 0.00100, 106.38 and the rest of that row to output these values I have seen so many options, don't know where to start.
View 2 Replies
Jun 14, 2011
I got a question that is driving me crazy. I have a DIRECTORY_LISTING event, that is executed with the files in a directory. This code is n a method o a class that only does the return a array with this informations (the code is above). How can I add a return of this array on a method in the DocumentClass that invoke and receive this value?
[Code]...
View 1 Replies
Apr 25, 2011
I want to return an array of images from a sql server through a web service written in asp dot net . I could return a single file by sending the byte array back . How to return an array of byte arrays or an image images back to the flex application?
View 2 Replies
Jun 14, 2011
I have a DIRECTORY_LISTING event, that is executed with the files in a directory. This code is n a method o a class that only does the return a array with this informations (the code is above). How can I add a return of this array on a method in the DocumentClass that invoke and receive this value?
//Lista arquivos
public function listaArquivos(diretorio:File, nome_arquivo:String,
lista_molduras:Array, index:int):Array {
[Code]....
View 1 Replies
Jun 14, 2011
I have a DIRECTORY_LISTING event, that is executed with the files in a directory. This code is n a method o a class that only does the return a array with this informations (the code is above). How can I add a return of this array on a method in the DocumentClass that invoke and receive this value?
//Lista arquivos
public function listaArquivos(diretorio:File, nome_arquivo:String, lista_molduras:Array, index:int):Array{
//Tenta fazer tudo isso
try{
[code]....
View 3 Replies
Feb 13, 2007
I have an array that holds some other arrays and I want to return just the name of the arrays that it holds, not their contents. In this example I want to trace the string "myDays_ar" but can only get the contents.
[AS]
var myDays_ar:Array = ["Sat", "Sun", "Wed"];
var myMonths_ar:Array = ["January", "July"];
var my_ar:Array = [myDays_ar, myMonths_ar];
trace(my_ar[0]);
[Code]...
View 2 Replies