ActionScript 3.0 :: Referencing Loaders In An Array?
Jun 28, 2010
I have a project that needs 4 levels of zoom, each with its own image loading in. So, to make things easier on myself, I made an array of the Loaders, so I can instantiate them and hide/display them when I need toHowever, this doesn't work as I had expected. I.e. (using just two level for simplicity):
Code:
private var photo:Loader;
private var photoLarge:Loader;
[code].....
View 4 Replies
Similar Posts:
Jun 28, 2010
I have a project that needs 4 levels of zoom, each with its own image loading in. So, to make things easier on myself, I made an array of the Loaders, so I can instantiate them and hide/display them when I need to.However, this doesn't work as I had expected.I.e. (using just two level for simplicity):[code]Is there any way I can reference the loaders dynamically so I can load/show/hide them on the fly, instead of hard coding it for each level?
View 5 Replies
Jul 25, 2010
I would like to know how to simplify this code. I would like to put the minnions into an array of loaders but everything I try does not give me the correct access. I would like to use for loops to put into the array setup.
package{import flash.display.*;import flash.events.*;import flash.net.*;import flash.net.URLRequest;import rebarr.*;public class Shrink extends MovieClip{ private var pictures:XMLClass = new XMLClass("xml/thepics.xml", "the pictures"); private var setup:Array = new Array(); private var minnion1:Loader = new Loader(); private var minnion2:Loader = new Loader(); private var minnion3:Loader = new [code].....
View 3 Replies
Mar 1, 2009
I'm taking my old as2 and trying to convert them to 3.what i wold like to know is whats the command for:
- saving a image.jpg while runing a film. .
is that posible?
-how do i create a array of loaders and mcs?
-how do i create an empty movie clip ?
-how do i open an internet page inside a swf.its easy to open a pic or another swf.but it cant be similar
View 3 Replies
Jul 7, 2011
I want a random image from the xml to be loaded and displayed when gallery is opened, together with gallery thumbs. Then remaining images are to be loaded in the background.
I am having problems pushing and retrieving data from the array that I have set up. The trouble I am have relates to the following code (but I attach a zip with all code and assets).
ActionScript Code:
private function _xmlCompleteHandler(event:LoaderEvent):void {
trace("loading complete");
_slides = [];
[Code].....
View 0 Replies
Aug 14, 2010
It works fine if I wait until the image is actually loaded (loadComplete) and then push the bitmap I create. If I try to push the loaders like you see here, it freezes up, every time. [code]..
View 5 Replies
Oct 15, 2010
I have a number of 'items' (mc's) contained in a scrolling mc that can be drag-dropped to other matching mc's. The items names are listed in an array and I wish to assign variables of suitability and feedback to each mc from the array also. I think this is called an associative array?
Having some trouble correctly referencing the items from the array. To explain, here's a working script with a simple array and an inefficient workaround:
[Code]...
View 4 Replies
Mar 9, 2009
I've got an array containing various sprites... I'm wanting to reference the sprite I want by its name rather than its index in the array, and was wondering if theres a simple way of doing this? I know I could do a for loop through all the array elements and see which one has a name that is equal to the name im looking for, but is something along the lines of myArray[elementName] possible?
View 5 Replies
Feb 25, 2010
I've created a for loop to do the following:add instances of button MovieClip from library to stagename the instances via name propertyadd instance names to array for later referenceadd event listenershese 4 steps are working peachy, however, I'm having troubles referencing these instances later on through my code. I'm pretty sure that the problem is in my data types not matching, but I'm not sure how to fix it.
var menuBtn:mc_menuBtn;var menuBtnList:Array = new Array();
for(var b:int = 0; b < numFiles; b++){ //add instances to stage menuBtn = new mc_menuBtn(); testClip.addChild(menuBtn); //adding button instances to
[code].....
View 5 Replies
Nov 3, 2009
I was wondering if anyone could tell me how to access a certain object in an array. for example, I created an array of buttons displayed on the stage. Now I need to attach an onRelease command to each one to launch a new image on the stage.e going round in circles with this. I have attached the code below for reference:
thumArray = [];
function thumbs(){
for (i=0; i<totalImages; i++) {
[code].....
View 1 Replies
Jun 13, 2011
Just learning as3. For testing purposes, I duplicated a movieclip 4 times on the stage and gave each mc a different instance name and put them in an array ("line1","line2","line3","line4"). Then I just want one movieclip to move 200 pixels based on the conditions of the array. Here is the code:
var stuff:Array = new Array("line1","line2","line3","line4");
for(var i:int=0;i<stuff.length;i++)
{
if ((stuff[i]) == "line4") {
trace(stuff[i]);
var duke = (stuff[i]);
[duke]y += 200;
}
}
It traces out the correct mc (line4) but ALL the movieclips move 200 pixels instead of the one (line4). Do you know why this is? I have a feeling that [duke]y is not the correct way to reference the movieclip.
View 2 Replies
Aug 25, 2011
I have three placeholder images, the contents of which are populated by an array ("galleryArray").These three placeholders are titled "placeholderLeft", "placeholderCentre" and "placeholderRight".
the contents of "placeholderLeft" will be: "galleryArray[n-1]"
the contents of "placeholderCentre" will be: "galleryArray[n]"
the contents of "placeholderRight" will be: "galleryArray[n+1]"
[code]...
View 6 Replies
Jan 4, 2007
I have an array defined in the main timeline to store some values. At some point of time, I am dynamically adding a movieclip to stage using attachMovie and then using a movieClip.onEnterFrame event to set one of its values by referencing to one value from the main array.(Sorry if the following description sounds a bit confusing. I am attaching a part of the code below to help describe the situation) The problem is that it is not able to retrieve the value from the main array no matter what I try. I tried adding a "_root" befor the array name and the index array id but it did not work. Not only that but the trace shows that it is able to retrieve the index id as well as the full array but not any particular value from the array - as in, trace(arrayname) outputs all the values from that array but trace(arrayname[a][b][c]) gives an output 'undefined'.
I have managed to make it work by creating a temporary variable to store that particular value just before the onEnterFrame event kicks in, but I would love to know why it is not working the way I thought it should. Here is a part of the code. If someone needs more info about the code then please ask and I will give it in the next post (The full code is way too large to be posted here)
ActionScript Code:
//------In main timeline
var movesNum:Number = 0;
[code].....
View 3 Replies
Mar 2, 2007
I have been trying to get this right for a few days now, but I am stumped. This code runs on the first frame of my movie:
Code:
_global.headingText = new Array();
_global.captionText = new Array();
_global.contentText = new Array();
[Code].....
View 1 Replies
Oct 16, 2011
I have a several objects nested within an array. I'm trying to reference a property of one specific object (intel).
function eventGenerator():void
{
var randomArea:Number;
randomArea = Math.ceil(Math.random()*5);
[Code].....
ainPlace names is the array's name. The random area variable contains the co ordinate on the array for the object. Each object on the array has a property called intel. The idea is I want to able to store the value of intel in a number and use in an equation. I would also like to be able to adjust the number. the trace function here returns an error saying it is undefined so eventArea.intel for some reason isn't referencing the intel property of the object.
View 3 Replies
May 2, 2005
fairly simple question (with a long explaination). I have an array, created from the results of another array and it's position in that array. There are actually multiple arrays It can be created from.
Eg.
Array1: clientName1, clientName2, etc.
Array2: clientType1, clientType2, etc.
Second Array: [clientName1,0], [clientName2,1] OR [clientType1,0] etc.
[Code]...
My issue is, I would like to be able to dynamically adjust the array that it is generating from. This would mean changing the bold bit of the code above. I have tried declaring a variable (type = names+"[i]") and using it in the linkArray declaration, however it will not see this as an array reference, only as a variable. What I want to know is, how do I reference the name of the original array as a variable so I can update it dynamically?
View 5 Replies
Dec 23, 2009
This used to work in flash 8.I just purchased CS4 and am trying to learn a few basics.I have nested arrays on frame 2 of the main timeline. [code]I can no longer use _root. on the mc to reference the main timeline.If I trace myQuestions from the mc I get an error.
View 14 Replies
Dec 30, 2009
I want to play an embedded sound referenced from an array.In flash 8 I would simply use this code.Quote:
var mySound = new Sound();
mySound.attachSound(myArray[0][8]);
mySound.start();
[code].....
View 11 Replies
Sep 6, 2011
I have a number of XMLList objects:
_xml.group1..image[i]
_xml.group2..image[i]
_xml.group3..image[i]
_xml.group4..image[i]
_xml.group5..image[i]
Im trying to reference each object thus:
_xml.group[myVariable]..image[i]
But it doesnt work. What's the correct syntax?
View 3 Replies
Nov 28, 2010
The behaviour looks little weird for me and dont know how to get valus through static property from an array:
[Code]....
but if I initialize missions with values not in the construtor but through variable initialization I gets output = 4; why is that? Doesnt static class initialize its variables in the constructor statement??
View 3 Replies
Dec 16, 2010
I am trying to reference a movieclip located inside an array to add an eventlistener and function... I am using array[0].add...ect. The code for the first movie clip works, but for the rest I get an error 1010.
Code: Select allvar image:MovieClip = new Image();
addChild(image);
const MAX_ITEMS:uint = 6;
[code].....
View 1 Replies
Mar 20, 2007
Code:
container_mc = _root.createEmptyMovieClip ("Page_Container_mc",100);
pageContent = new Array ();
[code].....
View 3 Replies
Feb 23, 2009
I know that a dynamic mc can be referenced using array notation
viz: myArray['someName'+i]
My question is ... can mcs that have been placed on the stage and given instance names be referenced in some similar way? If I have placed 10 mc's with different instance names eg mg1, mg2, mg3 etc, can I reference them using array referencing?
View 6 Replies
Dec 6, 2010
when I try to move my "stars" I get a 1010 error. when I try to loop a singular item, it works, but dynamically...
Using FlashDevelop.
main()
Actionscript Code:
package { import com.gfx.mainContainer; import flash.display.MovieClip; import flash.display.Sprite; import
[code]....
I can trace starArray, but I can't loop to each individual element and move it.
View 1 Replies
Mar 14, 2011
when I try to move my "stars" I get a 1010 error. when I try to loop a singular item, it works, but dynamically...Using FlashDevelop.
[code]...
I can trace starArray, but I can't loop to each individual element and move it.
View 2 Replies
Oct 19, 2011
I was just wondering whether it would be possible to remove an object from an array without referencing its index, for example when the index is unknown, or when you want to splice it from within the class itself, like ina die function for an enemy in an array. I have a project due on Friday morning, GMT.
View 6 Replies
Jan 4, 2006
i'm looping thru xml nodes and using this to attach clips to an empty mc:Code:item = _root.mainHolder.links.linkHolder.attachMovie("linkClip", "linkClip" + i, i);my question is how can I reference the previously attached clip so I can determine the _y property of the current item(clip).I'd like to do something like this.item._y= previously attached clip._y-previously attached clip.height
View 10 Replies
Nov 12, 2010
Is it possible to refference a movieclip in an array and then calling a methodfor ex.The movieclip i want to refference: main.box.mymovieclip
var current:array = new array();
push(main.box.mymovieclip);
and then like calling a method on it:
[code].....
View 1 Replies
Aug 26, 2010
My main project loads an external .swf ("room") depending on which button the user clicks. Once that external .swf ("room") is loaded, the viewer chooses a ("demo") .swf to view. For each button click, a loader is to appear showing the viewer that the desired room or demo is loading. All of this works fine for the web...please click the link below to view.
The problem exists when I try to publish as an .EXE. We'd like to send these out to prospects on CD and thus I need an .EXE to autorun when insterted in a PC. I've published the main .SWF (overhead map) as an .EXE and burned a cd containing all necessary files. Now when the user clicks a room and then a demo, the loader that shows up fine on the web does not appear...the button stays in the down state until the demo .swfs loads and then the demo appears and plays.
View 18 Replies
Feb 18, 2011
I'm making an image gallery and am loading about a dozen thumbs that load a larger image when each one is clicked. Works just great so far. But, as expected, there's a little pause before each corresponding large image is displayed.I'd like to eliminate the wait, if possible, so here's my question: As a matter of preference or programing style, whatever you want to call it, do you guys usually load ALL the images first, thumbnails as well as large images, before displaying anything on the stage? Or do you just load each large image when necessary, after its corresonding thumbnail is clicked?Sometimes I see very cool Flash sites that have the percentLoaded line or twirler displayed for what seems like a long time, but then each screen (MovieClip) after that displays fairly quickly and I'm wondering if that's what's happening - all, or at least a LOT of the images are being preloaded
View 3 Replies