ActionScript 2.0 :: Swap / Change Stage Instances With Library MCs?
Apr 4, 2009I am working om a navigation that should change/swap some instances clip to other ones from the library.[code]...
View 2 RepliesI am working om a navigation that should change/swap some instances clip to other ones from the library.[code]...
View 2 RepliesI am trying to add instances of the same library item on stage with tweening. Each one will "appear" on stage with delay. I have this code so far:
[Code]...
The following error: 1067: Implicit coercion of a value of type Milk to an unrelated type Number.
I'm using this code to swap different charts rendered in XML, but all that is happening is that they are piling on top of each other! How do I unload each one while another is loaded?Notes on the code: I have 52 different XML sheets to swap, all labeled Finance/"State Name".
Code:
this.addEventListener(MouseEvent.CLICK, financeSelect,true)
function financeSelect(evt:MouseEvent)
{
[code]...
Overall, I'm not sure what you mean about putting in the charts by script.
I can select one symbol and swap it with another, but why can't I swap multiple instances of the same symbol?
View 6 RepliesWhat my team is trying to do right now is build a game. It is a game where the user can build their own bike from different parts, and then test it in other challenges.
Right now I'm at the stage where they are building the bike. The first thing I'm trying to set up, is allow the user to push 3 different buttons that will change the appearance of the tires. I have the bike on a movie clip, then the tires on another movie clip within that, and then three different types of tire movie clips within that tires clip (make sense? bike>tires>3 tire clips). So I think the easiest thing would be is to somehow script each button on the root frame to just swap out the instance of the tire (the three types are: thick, aerodynamic, and trick).
I am learning Flex and have an image I would like to changed on mouseover, and switch to another state on click.I do not want to use any of the buttons available in Flex.Does anyone know th code to achiev what I want?
View 1 RepliesI am making flash segments for one of my professors for online teaching and the way he has his server set up, whenever there are interactive segments, the segments are done on one frame. Right now I am trying to make an interactive segment where you click on input variables to an AND gate (in circuitry) to change the input from 0 and 1, and then based on these inputs it will show the output.
Basically I want to start out by having them all display ?'s, and then if you click on the ? it turns into a 1 and then clicking again goes to a 0 and 1 and 0 etc. How can I either change what these buttons look like or how can I change the buttons to go from the ? button to the 1 button while all staying on one frame? I am very very new to actionscript (I know how to AddEvent Listener, etc, I just need to know what to write for my function)
I have 9 movie clips which are all of the same object, they get larger or smaller as the mouse gets closer to their respective centers. The functionalilty for this is in an AS3 class file that extends flash.display.MovieClip.How do I go about swapping depths so that the largest one is in the foreground, I am new to AS3 and dont seem to be able to find a way of getting the depth of the movieclip I am currently inside (this) and if I try to access the stage to call swapChildren I get the following runtime error:
View 6 RepliesI'm trying to duplicate custom MovieClip instances from the library in a document class.Here is my code:
package { import flash.display.MovieClip; import flash.display.Stage; import flash.events.*; import flash.net.*; import com.greensock.*; import com.greensock.easing.*; import
[code]......
I want 3 movieclips to change positions (swap places) on the stage randomly when I push a button and make sure they are always in different positions, so they don't randomise the same way.
cat, dog, fish
position_a,position_b,position_c
position_b,position_c,position_a
position_c,position_a,position_b
then loop and randomize the position they popup in again. So I can just keep on clicking the screen and they always change.
xxxa
xxbx
cxxx
I will have the 3 movie clips on the stage with instance names.
position_a
position_b
position_c
[code]....
I've created a movie clip and placed it in the library. I've given it a class name via the properties panel in the library. Every time I drag it to stage I want to make sure its alpha is set to 0. If I drag 300 of those clips to stage, is there a way to reference the class name I gave it in order to automatically set the alpha value as soon as they're dragged into the stage?
View 2 RepliesI would like to load movie clips from the library to the stage.How can I load them with some code on them? I mean load them already with onClipEvents on them, as if I added them myself to the stage..
View 4 Replies1. I've got a Main Document class, that loads external swf each with its own document class (they are pages and pieces of the site).
2. The Main class makes use of some movieclip simply instantiated from the GUI library. It all goes fine.
3. The external swf have references to the Main class, and here start problems: when I compile them, I get an error for every library mclip used by Main. See the attachment. A simple trace(Main) is enough to start getting all that errors.
A partial solution is to uncheck Strict Mode in publish settings
Basically, I have made a new FLA file, and in it's library I have created two symbols. Both symbols have their own class .as file.The first symbol is a movie called GridBox, and it's class has a package that uses lines to draw a shape, namely, a diagonal box tile.The second symbol is a movie called MainGrid, and it has a class that loads the movie GridBox from the library, in to its self.All my code works fine, the thing is, I would like to load more than one instance of the same movie clip, at a series of different locations, and im lost.Here is the code:
Actionscript Code:
package { import flash.display.MovieClip; public class MainGrid extends MovieClip private var myMovieClip:MovieClip;
[code].....
hmm how do I describe what I'm trying to do.. well here it is: In my flash library I have a series of movieclip with names like clip00, clip01, clip02 they are set to export for actionscript as the same name.
Now in my as file I'm importing a xml file that has the names of the clips which to place on the stage. Now if it were just a regular case I would do
[Code]...
I hope I am somewhat clear, please let me know if I can explain further. My project is really complex and I tried simplify it here. Please help or suggest alternative method.
why this sort of, but doesn't work?I'm just creating a group of buttons using imported pictures without having anything in the library.Here's the code I'm using:
[AS]clipArray = [];
posArray = [];
for (var k = 0; k<3; k++) {
[code].....
I have several instances of a movieclip which I placed on stage dynamically out of the library. Inside these movieclips I have a textfield. Is there a way that I can change the text of each instance independently?
Code:
var backing1:mcBacking = new mcBacking ;
backing1.x = 94;
[code].....
Say I've got something like this:
Code:
var parcher0:_parcher0 = new _parcher0();
_parcher0 is a Symbol in the Library with the Class definition _parcher0
I want to addChild this Symbol to an MC on the stage like this:
Code:
this.pccard0.sprite_.addChild(parcher0)
All good! Except I want to do the same thing, the same way, with this.pccard1.sprite_, and several more. When I do so, parcher0 only shows up on the final, most recently assigned addChild().
Is it forbidden to add a Symbol in this way in more than one place, and if so how do I get around it without creating a raft of arbitrary duplicates?
I am creating multiple bitmaps within a loop, and placing them inside their own MovieClip. I then have another MovieClip in the Library which I am calling and putting inside the MovieClip generated for the bitmap. Alas I cannot get multiple instances to work of the MovieClip from the Library. I think it must be my syntax in the following code..
Code:
for(i=0;i<10;i++){
this['bmp'+i] = new BitmapData(etc,etc)
this['box'+i] = new Bitmap( this['bmp'+i] );
[Code]....
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.
the idea is to create a loop to that displays 16 cards face down in two rows and eight columns using either a "for" loop or "while" loop, execute 16 times once for each clip.use new to dynamically create card instances based on the Movie Clip symbol in the library.use a modulo operator to operate the x position of each clip use Math.floor to operate the y position of each clip set dynamic text value of the card clip to show appropriate card number add card to the display list if using the iteration variable ("while" loop).this is what i am using and i get one card (the stack of 16) in the bottom left hand corner with a 16 trace statements of "instance 2"
//create variable for number of columns
var numberOfColumns=8;
// requirement 1
[code]....
Im Have a function which is called after n ms and in this function I have code to change a movieclip to visible. I have 10 different movieclips with instances named n1, n2, n3 etc So everytime I call this function I want the next movieclip made visible.
So the code I'v been trying to use is this -
ActionScript Code:
function startNoFX(eventArgs:TimerEvent){
i++;
n+i.visible = true;// where i will corespon to the number giving n1, n2 etc
}
Im sure I'v seen something similar like this done before, I know I could write code for each individual Movieclip but I want to keep it tight.
i've made a Tile-class where i set "buttonMode = false" for each instance. I have been able to test that the value can be change from the main AS.-file, so this part works.
Code:
package
{
import flash.display.MovieClip;
[Code]....
This does change "buttonMode" but only on the very last instance. So this is where i'm at a loss -- i thought you could change all instances with one command like this but apparently not?
I have this library with more than 80 objects that i want to bind to my keyboard. My idea is use the "keyCode" to call the object to the stage, constructing the object's name inside a variable.This is the code that I'm trying to use, but the bold text line always give me an error (constructor, syntax and others) depending how i write that line.[code]I'm not very experienced with AS3 so i don't know if this is the right approach to solve my problem. Any help is well received.
View 3 RepliesI am making a flashcard game with five subjects. It has buttons for moving forward and back,and buttons for switching to another subject The card instances for each subject are stored offstage, in separate frames (five in all), and their names are stored in arrays (five in all) Each time a button is pressed, the appropriate card tweens onto the stagepoint were still visible (not sure why, since the menu's on it's own frame), so I wrote a function to clear everything offstage whenever the menu button is clicked.My problem is weird: if you are in the math subject, switching to geography returns this error:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at flashcardapp1_fla::MainTimeline/frame3()
at flash.display::MovieClip/gotoAndStop()
[code]....
I'm new to this OOP stuff, and I'm having a hard time understanding all of this.I'm trying to recreate in AS3.0 with classes a simple whack-a-mole game I created in AS2.0 using timeline coding.I've read through a lot of forums, but I still don't understand what exactly I'm doing wrong.Heres my setup:I have a movie clip named mrBunny (my girlfriend told me to change it to bunnies as moles were too ugly.). Now there are 6 instances of mrBunny on the stage, each named mrBunny0-5.The mrBunny symbol is linked to the com.mrBunny class.The class has a method called randomPlay(); which I use to randomize the animation times of mrBunny.I also have a button on the stage with the class stageBtn.
package com{
import flash.display.SimpleButton;
import flash.display.MovieClip;
[code].....
I'm working with Flash Builder 4.6 as an IDE and Flash CS5.5 to create library items. The problem is - when I put an instance of a library item on the stage or inside of another item, Flash Builder fails to detect the instance name that was declared in Flash CS. This doesn't prevent the code from compiling just fine though.
I understand that the IDE only sees the fields that I have declared directly in the .as file, but it really hinders me that I the IDE goes crazy when I do this.
Is there any way to circumvent this - other than dynamically creating and placing the instances?
I was just wondering if there was a way to find all button/dynamic text instances that are on stage. This would allow the dynamic creation of array instead of having to manually create this array.
View 9 RepliesI have a stage instane called 'titleBox' in a SWF, which when loaded is dynamically filled in.
When testing straight from the SWF there is no problems at all, but when the SWF is loaded into the main SWF I get the error:
'Error #1056: Cannot create property titleBox'
Which I can't understand as it exists, any suggestion would be awesome.
Is there any way to iterate through instances placed manually on the stage in Flash IDE? For example I have 3 "Dog" class instances placed on the stage and I'd like to access them all from document class without giving them instance names.
View 3 Replies