ActionScript 2.0 :: Loader Instances - Cannot Create Dynamic Names
Jul 30, 2009
I have a number of loader instances (loader1, loader2, loader) which I will use to load pictures. I tried to create a loop and run the command
for(var st=1,st<4,st++) {
_root.movie_clip.loader+st.load("picture.jpg");
}
The concatenation "loader+st" doesn't seem to work. Is it not supported in AS2.0?
View 2 Replies
Similar Posts:
Apr 18, 2011
i made a custom class where i would like to create x instances of a movieclip. But the following doesn't work:
[Code]...
I keep getting the error: Scene 1, Layer 'Layer 1', Frame 1, Line 5 1119: Access of possibly undefined property Collector through a reference with static type CustomClass.
View 3 Replies
Oct 29, 2009
I create X instances of a class (called SM) depending on a varibale I have (called here howmany), but later on as I want to check their states with a while, I need to have diferent instances names (sm1,sm2,sm3...).[code]
View 1 Replies
Dec 6, 2009
I have the following code below which creates two movie clips on the stage dynamically. How would I give the two movie clips different instance names, so I can add separate event listeners to them?
ActionScript Code:
for (var i:uint = 0; i < 2; i++) {
var my_box:Box = new Box();
[code].....
View 9 Replies
Feb 16, 2011
Is it possible to create one or several instances of a movieclip from the library with variable names
my1_mc
my2 _mc
.........
my5_mc
so that I can make a function that will use the name of any of these movieclips.
View 4 Replies
Jul 8, 2009
I have an array of data that I'm using to create thumbnails and labels I'm using "Loader" to load the thumbnails (sample code below) but what I'm wondering is how I can make the name of the loader dynamic so that each child gets named "image1, image2, ...". I tried adding "[i]" after the "image" for each item in the code but it complained about missing semicolon before left bracket.
var image:Loader = new Loader();var target_image:URLRequest = new URLRequest("images/" + xmlData.Product[i].id + ".png");image.name = "image_"+[i];
image.load(target_image);
[code].....
View 3 Replies
May 17, 2010
i have sprites in the library with linkages in them.. how would i create new instances of them if they are stored inside an array?
[Code]...
View 2 Replies
May 27, 2010
I'm trying to create dynamic function names, something like this:
[Code]....
View 1 Replies
Jun 15, 2010
I am creating an app using CS4 flash. I have it calling an asp containing xml with from 1 to 30 records. The xml example at the bottom has 3 records.I was hoping someone would be able to tell me the code needed for my swf to check how many records there are and generate that many "pages" from a page template, with the data dynamically entered into text boxes on each generated page.I have included the method i am using to call the xml.[code]
View 5 Replies
Jun 28, 2009
Is it possible to, if you have an array of class names like ActionScript Code: var city01names:Array = ["pic_01", "pic_02", "pic_03" ...] make a new array which would read these names, instantiate them, and push them into a new array containing the instances of all these pictures, which I could then use for a slideshow?
[Code]...
View 7 Replies
Jun 26, 2009
I want to load multiple players in my solution.Is there any problem if they have same data model with different instances names?
View 1 Replies
Jul 8, 2011
I've continued with it and have hit another hurdle. When I run the loop to load in the XML images, inside the same loop I add instances of a "thumb" movieclip onto the stage. It's just a little graphic that I want to use as thumbnail buttons. So for example, if the XML loads in 3 images, 3 instances of the "thumb" mc also load onto the stage. I currently give then unique names in the loop but that name gets overwritten each time the loop runs. How can I record each name of the instance? I'm guessing an array but how do you populate an array with a loop?
Then, I'm hoping if those names are recorded in an array, then I can reference the different thumb instances (so they can do different things with the images) and also use removeChild on them when I close the gallery and load in the next gallery. Here is my code so far,
[Code]....
View 6 Replies
Mar 4, 2009
where each of my buttons have a dynamic text label.
So this button is a symbol, and the instances are named let say btn1, btn2, btn3. The label tag name inside the symbol is btnName.
How I can make this work if I define my array on top level? How I can make sure that the label btnName will have the correct array name for each btn instances?
found out the benefits of .children usage...
btn1.children.btnName = xArray[0];
btn2.children.btnName = xArray[1];
...
View 5 Replies
Nov 6, 2009
Is there a way to group a bunch of movie clip instances into a single variable? Reason is, I have a lot of movie clips acting as buttons that I have added to event listeners. All of the movie clips with do the same functions and I have a few different functions created.
For example. How can I change this
Code:
mc_aitkin.addEventListener(Event.CHANGE, changeAlpha);
mc_anoka.addEventListener(Event.COMPLETE, changeAlpha);
mc_aitkin.addEventListener(MouseEvent.MOUSE_OVER,hoverOver);
mc_anoka.addEventListener(MouseEvent.MOUSE_OVER,hoverOver);
[Code].....
View 3 Replies
Dec 8, 2009
I have run into a problem when trying to reuse SWF/Bitmap file loaded by Loader object. As far as I know there is only one way to do this - by using something like this. However it`s not working for me. My code:
Code:
var loader2:Loader = Loader(duplicateDisplayObject(loader1, false));
Even though I addChild() duplicate loader to stage afterwards, it doesn`t appear.
View 5 Replies
Jun 28, 2010
I have a flash file that counts and displays the number of images in a particular folder, that part appears to work fine. I require a reset button so that the alternate directory for the images can be tested as well. For this I need to delete all the instances of the loader I created for each image, but am unable to do so.
ActionScript Code:
import flash.display.Loader;
import flash.net.URLRequest;
import flash.events.IOErrorEvent;
[Code].....
View 2 Replies
Jul 24, 2009
i have a UI loader that loads images (arabic file names) from folder based on some user input...
the images loads fine when i'm opening the SWF file, but when it's on an HTML page, the files' names are encoded some how and then not loaded ..
when i write the full path of an image in the browser's address bar, the image opens fine.
is there away i can keep the file names in arabic, and make them load when the swf object in an HTML page ?
View 3 Replies
May 25, 2009
I am trying to load in 5 pictures but 2 of those pictures need to be added multiple times to the same scene. For example you would use Loader to load one tree but would show that tree 9 times. The problem I am experiencing is that each object loads fine once but objects that are the same with different x and y values are placed at the last location that was set in the loop.
for(var i=0; i < LoadedXml.resources.resource.(@type==LoadedXml.resources.resource.@ty pe[fileCount]).@count; i++) sprite.name = LoadedXml.resources.resource.@type[fileCount] + i; sprite.x = LoadedXml.objects.object.
[code]........
View 1 Replies
Aug 18, 2009
Hi guys, I'm wondering whether any of you have any opinions on whether you instantiate a Loader into an instance variable, or whether you declare a local variable to hold the Loader object.
I'm coming at this from a memory management / garbage collection perspective.
I only need the Loader object to load the file and register the event listeners. So I don't really want an object-wide instance variable to hold this loader object (which is what Adobe does in most of their examples), since I can always access the loader.data through the event's target property.
[Code]...
View 2 Replies
Apr 21, 2010
I'm creating an image loader with a specific effects that requires layering multiple masks over the same movieclip. in the timeline it looks like this:
What I want to do is add an instance of the loaded image into each of these masked movieclips. I'm trying this:
create a new instance of the loader and store it in an Array
Code:
for (var j=0; j<allThumbs.length(); j++) {
imgLoader = new Loader();
img_arr.push(imgLoader);
[Code]....
The only way I've been able to get this to work is to create an entirely new Loader object for each movieclip instance. Doing it this way loads the same image 4 times... that's not acceptable.
how I can store the image that is loaded and reuse it in the different movieclip instances?
View 1 Replies
Jun 22, 2010
Ok, Background. I have two objects both of which im spawining in though code. We will call them bullets and wolves. They have their own .AS files which tells them everything they need to know about themselves. I figured i would do most of the hit testing on the bullet.AS file, hit testing against the wolves as there were going to be a set number of wolves but not a set number of bullets.o, I named them by running a loop and putting the linenewWolf.name = i.toString();Yes, new wolf is a declared variable, and i is the name of the variable that makes the loop run. I also have a test in it, and it works fine.
However, The hit testing is where i come into an issue. Remember, its on a seperate .AS file. The wolf maker and namer is on the main flash page.The hit testing function isif(this.hitTestObject(a)){i changed up my variable name to run a second loop. first variable name is "i" and the second variable name is "a"And for some reason i get a type error 1034, which from what i understand is an error that you get when two instance names are the same. Also, If possible, i would like to add letters to the name of the object, but im not sure if flash will let me as i belive the code would look something like this
View 1 Replies
Nov 29, 2009
Is it possible to place two or more instances of the same loaded from a loader Bitmap in one container?
View 1 Replies
May 27, 2010
I am trying to create a pretty simple image script for a flash website. What it does is to create a container named mc and then loads in an image into the mc from XML. It goes through the XML file like in a for each loop. But the problem I have is that every image container then gets the name mc. So then now when I try to build the function which makes it possible to press on one of the image containers to enlarge them, it only makes the last image larger since that is the last one to be created with the name mc. So how do I give every movieclip that I create a different name such as mc1, mc2 etc.[code]
View 8 Replies
Dec 14, 2010
I was wondering if it was possible to create the name of a NEW array dynamically. I have tried the following with no success. Does anyone know if this can be done?
Actionscript Code://Tried and failed_global["newArray"+newArrayNumber] = new Array();//Tried and failed_this["newArray"+newArrayNumber] = new Array();//Tried and failednewVariable = _this["newArray"+newArrayNumber];newVariable = new Array();
View 1 Replies
May 18, 2009
I have an array that houses the names of six movieclips. I randomly select three of them. I am trying to get my randomly chosen movieClips to do what I want them to do. I have tried the following code to get the first to fade in:
[Code]...
But it does not work. The trace comes back with the full movie clip name ex: mcTom, but even though that value comes up in the trace, the AS doesn't see it as a movie clip. Any thoughts on how I can correct this?
View 4 Replies
Jul 3, 2009
I am trying to simplify things by using dynamic MovieClip names. I have three MovieClips on the stage.
1) mcPage1
2) mcPage2a
3) mcPage2b
But my code isn't working. I'm guessing the "this" part is what is messing it up. Thinking that the computer doesn't know which MC is "this". It traces fine outside the function, but inside the function it traces undefined.[code]
View 2 Replies
Aug 1, 2005
I've got this code but apparently the reference to the button doesn't work since i get an AS error upon execution.
PHP Code: [code].....
I've already tried without the brackets but that yields the same result.
View 3 Replies
Nov 27, 2006
Is it possible to have dynamic sprite names? For example if I am constructing a tile map from an array how can i give each sprite object a different name and referense it later?
in actionscript you could just do
attachMovieClip("blah"+i+"_"+j...
and reference it with root[name]
how could I achieve this with actionscript 3?
View 1 Replies
Jul 23, 2008
All the nav links are correct but i am having problems with the background color and placing the submenu nav links.For the background color i am have created a function drawBG. At the moment i have set the name static, but i realise that sometimes i have 3 submenu.So i can't use the same name over and over again. How do i create the names dynamicly for say 3 submenu'sso i have something, likemainMenuBG - submainMenuBG - subsubmainMenuBG - subsubsubmainMenuBG
Code:
function generateMenuNew(container, name, xPos, yPos, depth, node_xml, bgMenuDepth, bgName) {
[code].....
View 6 Replies
Jun 22, 2010
Is there a way to make dynamic var names? Cant remember how to do this.
Something like:
NameCount = 1;
Obj.eval("Item" + NameCount)) = "hello world";
Obj.Item1 // trace "hello world"
View 3 Replies