ActionScript 2.0 :: Edit Movieclip Instance In An Array?
Jul 22, 2009I was aware that an array is filled from 0, but it was easier to lay it out that way for myself.
View 2 RepliesI was aware that an array is filled from 0, but it was easier to lay it out that way for myself.
View 2 RepliesI am creating movieclips into which I want to load thumbnails which are to be loaded dynamically. I'm not sure if the solution I am trying to build is the more effective way to do this; I'm still quite a noobie.
Each movieclip container which I will use hold the thumbnails is of a size to hold 16 thumbs, so the number of holder movieclips required is calculated at the time the xml loads; with the movieclips then being created, named and stored in an array. (The idea is to then move between these movieclips (and so the thumbs) using previous and next buttons) - however, I'm not at that stage yet!
However, when I call each movieclip to place the loaded thumbs in, the code throws the "#1010: A term is undefined and has no properties" Error. I think this is a problem with the array; and possibly the mc not being defined properly. However, I am not sure where my problem is.
[Code]...
I created an Array of lrgIcons that contains several MovieClips, they are then positioned within a second MC and pushed to a second array of lrgIconsOnStage, they are enabled as buttons and assigned an event listener (all of this works fine). Problem is, I want to know which lrgIcon is selected and react to it with an if statement. When I trace the array of lrgIconsOnStage I get [object amazonLrgIcon],[object emailLrgIcon],[object gmailLrgIcon],[object messagesLrgIcon],[object missedCallsLrgIcon] and when I trace e.target I get [object amazonLrgIcon] (depending on which item I selected, which in my mind, should trigger the code correctly, but it does nothing, Why?
Code:
var currButton:String;
var lrgIcons:Array = new Array(amazonLrgIcon,emailLrgIcon,gmailLrgIcon,messagesLrgIcon,missedCallsLrgIcon);
var lrgIconsOnStage:Array = new Array();
var lrgIconPosY:int = 69;
var lrgIcon:MovieClip;
[Code] .....
Here's what I am trying to do: I have an array of movie clip instances called iconArray[]. what I want to do is create the effect of shifting icons on screen right or left. Lets say we're shifting the icons left--what I want to happen is the icon on the left (iconArray[0]:MovieClip) to tween to the left about 20-30 pixels and then fade out, which I can currently achieve. The problem is I want copy the instance of that icon as a temp MC and push it onto iconArray and then have it fade in tween from the right.
In other words, the left most icon should "wrap" back around to the position of the right most icon but in order to create the illusion without having the left most icon pass over the other icons (which looks tacky) I want to create a copy of the left most icon and push it onto the array as a new movieclip with the same image and have that fade in from the right while the other one dies off.
[Code]...
it does not create a new icon, is seems to point to the same movie clip as iconArray[0] and any adjustments I make to the x or alpha affect the original MovieClip instance and not the new on I created and pushed onto the array.
How does one go about copying a movieclip, storing it in it's own instance/var so it can be displayed and manipulated as a separate entity?
I have an array of movie clip instance names:
[Code]...
What I want to know is how I would go about making them all their default colors when you hit a movieClip instance that acts as a reset button. I can't seem to get it.
in my project i call the "animateLeft" function like 50 times, it makes a lot of tweens, but now it create new tweens every time the function is called, witch is not memory effective? Are there a way to declar the tween once, "var cTween0:GTween = new GTween();" and then just edit the tween insted of creating a new one?
[Code]...
I have a scrollplane instance onstage that I need to skin, but flash is not allowing me to double click the instance to edit its timeline. Does anyone know why this may be?
View 1 RepliesI have created a game using an array. character moves around, and collects coins, the usual platformer stuff.My question is this - is it possible to make it so that when a coin is collected, it doesn't reappear when the level is reset (which happens when the character dies)? I've provided as much code as I think is needed, hope it's not too much.Here is an example array:
Code:
var lvlArray1:Array = new Array(
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
[code].....
I am curious if this is an okay implementation of the Array.filter() method.
[Code]...
I was not able to figure out an implementation of the callback function for the filter() method, where the callback was outside of the getGallery() function. I wonder if there is a way to get the isGallery function outside of the getGallery scope?
I'm trying to get my new character system working with my fairly simple physics system. I have code at the bottom of the page which demonstrates my collision function. The most important line, which I've bolded, is:
Code:
currentPlayer.y = hitBlock.y - ((hitBlock.height * 0.5) + (avatar.height * 0.5)) ;
I wrote this myself, all logic dictates that it should work. We start with the position of the centre of the block. We add half of it's height, to reach the top surface of the block. And then we add half the avatar's height, which should give the exact point to put him at so that his feet touch the top of the block. This code should be able to account for any arbitrary heights of block or avatar. But it's not working, my avatar is stuck just a little bit inside the block.As far as I'm aware, my math is perfect. So the only source of the problem I can think of is in the objects themselves. I'm not fully sure what the registration point is - logic would dictate that it's the recognised root point of the object, and when I tell an object to go to a coordinate, I would guess it's moved so that point rests exactly on the coords.I'm not entirely sure how to change it though.When I look at my movieclip in edit mode, it look like this.
The image has been downscaled so it's tricky to see the details, but I want to draw attention to the fact that there's three points of interest on it. Around the middle of the bounding box is a white circle,I think that's the registration point. A bit above that, on the figure's upper torso, is a crosshair. And to the topleft of the bounding box, just outside of it, is a second crosshair.What's also interesting is that when I deselect the movieclip, the white circle and the second crosshair (outside the BB) vanish. But the one on his chest stays put.If I move the movieclip, all three of the above things go with it. I can select the circle and drag it around, but not the crosshairs.my collision code:
Code:
//if main hits a block, then stop jumping
//this loop will check a hit test with any block
for(var i:int = 0;i < world.blockHolder.numChildren; i++)[code]............
I'm actually relatively new to flash and actionscript but I could say I have fair knowledge about them. So anyway, I usually build flash websites the traditional way using timeline animation and scripting. Today I had a job interview and they said they're looking for someone who can develop any web design into a Flash CMS with a back-end office for the client to edit the content without having to edit the FLA file or any code.
Accordingly, I'd like to know where and how to start. What are the main concepts I should follow/adapt?
Say User uploads a front facing photo. I give co-ordinates. I want to give user facility to move the points to match eyes and lips on their uploaded photo. So I want to get the editable shape. I think we will need to use bezier curves for this. How can I modify my code to line through the bezier control points?
View 1 RepliesI want to load Variables from a .txt-file to edit the properties of a movieClip. For example: 700 is written in the .txt-file. After loading the Clip the x-position of the clip should be set to 700. How can I do this?
View 14 RepliesHow do you view and edit a button symbol's instance name after you have made the button symbol?
View 3 RepliesI have a movieclip instance named 'placeholder' on the canvas, and I want to change the alpha of the named movieclip from it's class without effecting the alpha of all the movieclips of the same type. How would I specifically target the named movieclip instance that is on the canvas?
View 3 RepliesFor some reason, the same code works now, without any problem at all. I don't know what happened, or why, but I no longer have this problem Here's the original post: To put simply, I created a MovieClip, put it with addChild() to stage, and when I tried to call this piece of code:
[Code]...
how can i access a movieclip via its instance name in another Movieclip class?
and a nother question how can i access a movieclip via its class name in another movieclip class?
BTW i want to access the movieclip child
I am trying to make a reference to a movieclip instance that is in another movieclip.
Here's the deal: I have a main timeline for different pages of a website...then within that I make all of the art on each page into a movieclip so I can do animations every time that main timeline frame is called to, yet still keep my main timeline clean.
Within one page's movieclip I have a few buttons that I want to use to go to other pages by referencing them on the main timeline.I have been using this: (home_about is the about us button on my home page, and frame 31 is on the main timeline).
home_about.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndPlayFromFrame_6);
function fl_ClickToGoToAndPlayFromFrame_6(event:MouseEvent) :void
{[code].............
Since this home_about is within another movieclip,I get the access of undefined property error. Do I need to change the code I've pasted above or add in variable definitions to fix this?
I am trying to create an interactive graphic. Basically, it's three squares layered on top of each other, with a large square in back, a medium square centered in the middle of the large square, and a small square in front centered in the middle of the medium square.
When you roll over the medium square, say, it expands to almost the size of the large square and some text fades in, and the small square on top of it fades away. When you roll off of the medium square, it goes back to it's smaller size, and the small square fades back in.
Currently, I have the actionscript in the movieclip to make the medium square get larger and smaller (and the text fade in), but I need to somehow reference the instance of the small square movieclip to hide it when I roll over the medium movieclip.
My actionscript for the medium square activity, currently:
Code:
stop();
this.onEnterFrame = function(){
if(rewind == true){
[Code]....
how to have this rolling over action get rid of the small square and then bring it back on roll out.
Does creating a new instance of an Object that uses an identical name to an older instance, delete the previous instance? Or should the original instance be deleted first? The code uses a ridiculous amount of XML vars. Isn't it less memory intensive to parse the XML and save the properties to an Object, and then delete the XML Object, rather than keep the XML Object around and reference it's child nodes directly? Is it better form to break up a huge XML file (>600lines/3200vars) into smaller chunks?
View 1 RepliesI am trying make a button that plays a movieclip whose instance name is in an array.
for example my array (named "current") consists of an movieclip instance name:
ActionScript Code:
current = ["instanceName"]
Using the trace command, I know that the array definitely contains the name.
Now, I want to insert that instance name from the array into a gotoAndPlay command on a button like this:
ActionScript Code:
(((instanceName from Array here))).gotoAndPlay("2");
I have this code which tests if another grass instance is next to the current one. So far so good. The trace statement correctly outputs when it finds an instance nearby. The first time this will say: "instance1 100,100 found instance3 97,100 nearby" which is correct. But further down the code when I do the hitTestPoint, the wrong instance is in the array. Instead of saying "testing instance3 97,100 97,100 true" it has instance1 in the array and says "testing instance1 100,100 97,100 false". How can that be when I put instance3 in?[code]
View 1 RepliesI want to loop through an array and call the same method for each button instance. So instead of hardcoding this:[code]
View 5 RepliesI have some movieclips on stage each with an instance name like this: 101, 102,103,104.. etc.When I click one of them, it's istance name is added in an array:[code]I've got a button on stage too and I want when this button is clicked to change the Y of all the selected movieclips:[code]
View 6 RepliesI have a bunch of buttons on stage, and i want to place all of those buttons names in an array so i can assign an event listener to them easier. What i have is:
Code:
var btnArray = new Array["btn1","btn2","btn3","etc...."];
for(var c=0; c<btnArray.length; c++)
{
btnArray[c].addEventListener(MouseEvent.MOUSE_OVER, doSomething);
}
But that isnt working.
This should be simple but I can't come up with or find the answer anywhere. All I want to do is create a series of Arrays with instance names generated on the fly. I then want to reference these later. I have a "for" loop with a variable "count" that I want to add to a base name of rowArray and use the result to create an Array. I would think that it would look something like this:
[Code]...
I'm making a tile based game in AS3. Now I need to check a collision between the player and each tile (which are created in an array with 300-something instances).
I want to do that in my Main class. The player is in a class called Level and the tileArray is in another class. When I execute, I get the classic #2007 error - "Parameter hitTestObject must be non-null".
MAIN
public function checkCollision():void{
if(_level._tileSetBMP._tileArray[0] == null){
_level._tileSetBMP._tileArray[0] as flash.display.DisplayObject;
[Code].....
What can I do to make a hitTest with each of the [0]-instances of the array?
In Flash, I created a grid of 400 buttons with instance names c0 through c399.[code]...
View 2 RepliesI have just started actionscript after a long break, I am creating a crossword and each box is an 'Input Text' field. Since there are a lot of text fields, I do not want to have to create variables for each text box,I wanted to do something like this:
ActionScript Code:
var inputs:Array = new Array( "_1a", "_1b", "_1c" .. );
for( var i:int = 0; i < inputs.length; i++ ) {
[code]....
How do you pass instance names into arrays? I've got a bunch of movieClips of states.
They all have instance names.. alabama, arkansas, delaware, florida, georiga, etc..
I am trying to send them all to an array because I need to be able to disable the movieClips all at once and I don't want to call each one separately. I setup an array and a "for" loop, and it properly gets each value in the array:
ActionScript Code:
states = new Array(alabama, arkansas, delware, florida, georgia);
stateslength = states.length;
[Code].....