ActionScript 3.0 :: Adding Multiple MC's Via A Class?
Dec 23, 2009
in my Doc Class I am trying to load in multiple MCs onto the stage which come from a class held in the library ...I get an error whilst trying to name them .. perhaps it too much of an AS2 way?ps code is only a snippet of the problem..
Code:
for (var m:uint = 5; m > 0; m--)
{
[code].....
View 2 Replies
Similar Posts:
Dec 28, 2009
I want to move my multiple externally loaded images a little each time they are added to the stage along the x axis via the Loader class. It all works - But HOW do I access the added graphic synatically, so i can change its x pos?! Ive tried picLoader.x ... but that's the Loader - NOT the image...??
Code:
private function setPics():void
{
for(var i:int = 0; i < xItems; i++)
[Code].....
View 2 Replies
Nov 24, 2011
The name of my DocumentClass is Main. So, what's the difference between :
var myClass:Main = new Main();
var mcInLibrary:MovieClip ;
/////////////////////////////////////////[code]............
View 1 Replies
Sep 21, 2010
I have a problem when making flash applications with more than one frame that has symbols placed on it in that I can't declare all of the event listeners for the objects at the same time and I have found that even if I put them all on the first frame, add the event listeners, then click through to the next frame then the buttons won't work on that frame.
Does anyone have any idea how I could solve this? I did consider myself a fairly competent AS3 programmer until I realised I had no idea how to handle this sort of thing. Solved: I initialised the clips from my external class and then addChild'd and removeChild'd them as I needed to and placed their x and y on addChilding.
View 2 Replies
May 18, 2010
I'm creating a slideshow where each slide can have:- a video or a still- 1 audio track or many (up to 3)- 1 button or many (up to 3)I was thinking that each slide can be it's own object, and then I would pass the video, audio, buttons, etc., into it as parameters:
package
{
import flash.media.Video;
[code].....
View 2 Replies
Feb 12, 2009
I have a class that represents a turret in the center of my screen.When I hold down SPACE, I want it to create a "bullet"-object that moves in the direction of the turrets cannon, every frame the SPACE key is held down. I am having problems with this cause I am getting this error when I am trying to create the object:
Error #1009: Cannot access a property or method of a null object reference.
This is where the error occurs:
ActionScript Code:
public function chaingun(x_:int, y_:int, rot:int, cd:Number, spd:Number, sprd:Number, life:Number) {
this.Cooldown = cd;
this.Speed = spd;
[code]....
PS: What happens is that when I press the SPACE key, the "turret" class event handler runs the function "Shoot_Chaingun" and that function creates a new Chaingun-object (which actually is a bullet), that inherits the x, y, and rotation of the turret, along with some additional varaibles, including lifetime. Then upon creation, I use "addChild(this)" to add it to the main stage, and "removeChild(this)" once it's lifetime is up.
EDIT: And also, I just realized I don't have a MovieClip linked to this chaingun class. How do I make sure that every time a chaingun object is made, the MovieClip is also loaded?
View 4 Replies
Sep 8, 2010
I'm building a calculator of sorts and have about 7 input text boxes (input text chosen) that users can enter numbers. At the bottom I have a calculate button that adds all of the numbers users have input into the boxes. The answer goes into a dynamic text box. It all works fine expect if a user does not enter in a number in one or more of the boxes. In other words, users would have to input a number in each box for it to work, I don't want that.Here is the code on the calculate button:
TransportationTotal = Number(Limo) + Number(SUV) + Number(HorseCarriage) + Number(Boat) + Number(Helicopter) + Number(LuxuryCoach) + Number(LuxuryCar) + Number(TransportationGuests);
}
whereas the names in brackets are the var assigned names. Do I need to declare the var's beforehand? Tired this and did not work.
View 2 Replies
Jun 16, 2009
I've got a long list of similar movieclips I'm adding to the stage. There's 9 in total and the code looks like this...
stage.addChild(zone0_mc);
zone0_mc.x=267.6;
zone0_mc.y=120.5;
[code].....
View 3 Replies
Sep 30, 2009
I have 60 pictures- set sequencially in frame by frame animation.I would like to enter them (imported or from the library- whatever works) into the timeline one picture per frame (or keyframe) so when I can hit play and see the animation.
View 1 Replies
Jun 3, 2010
I have entered the following code and both items do import, but i cant control the label of the second library item called "Cool"After doing some digging, i think i found out the class name of the second object was called "Cool" and the base class was "import flash.display.SimpleButton;" so it looked like i had to import that class at the top like i did! But still not working. and still no joy!I think i need to add in "public class Cool extends SimpleButton" so it inherits the SimpleButton class after the first public class and then create a new function called "public function Cool() " and then add the function body but when i go to do that it all goes wrong. Am i on the right track or am i missing a trick!!
package
{
import flash.display.Sprite;
[code].....
View 3 Replies
Jan 25, 2012
I just started recently using more of AS3.All of our previous banners were in AS2 (before my time here) so I just continued to work within that.I am on a Mac and using Flash 5.5.However, I am now creating some new banners in AS3 from scratch.There are 6 total clickTags on the banner that we track.There is an invisible button over the entire banner that stays on there to a specific keyframe and has a clickTag.Then, at the very end there are 5 text buttons each with a clickTag.
When I test it in Flash 5.5 it plays fine but gives me the following warning under the Output tab:WARNING: Actions on button or MovieClip instances are not supported in ActionScript 3.0. All scripts on object instances will be ignored.I have done some research and keep seeing that I need to place the actions on separate keyframes.What code do I use and does each clickTag need to be on it's own keyframe?Below is the general clickTag code we have been using but the banners are in AS2.
on (release) {
getURL(_level0.clickTag2, '_blank');
}
View 4 Replies
Aug 20, 2009
what I want is for the text area box to be added the same amount of times as there are nodes in my xml file (currently 5)So, I'm trying to add 5 textboxes to the stage.Whenever my loop fires this
Code:
//make titles
var songTitle:TextField = new TextField;
[code].....
View 5 Replies
May 23, 2010
Adding frames across multiple layers...that's what I want to do. I do not want to add frames one layer at a time if I can help it as I have a good 20 layers going and I'm bound to miss one or something. Now if I am in a tween layer adding frames I know what that does...but it will add more frames of what ever is going on at that point in that layer...right? (Ex. empty space...you will be adding more empty space...next layer has a tween...you are adding more tween...right?)
View 1 Replies
Jan 19, 2011
I have seven movieclips lets say from mc1 to mc7 they all have their respective classes Mc1 to Mc7
is there a more efficient and faster way of adding them to the stage then declaring and addChilding them one by one in the code?
View 2 Replies
Oct 2, 2009
I am doing a flashlite project (AS2) for an embedded application and am having trouble figuring something out. I want a single instance of a menu button that I can move with keyboard cursor presses to specific locations on the Y axis. Figuring out that part was easy but I am stumped on adding multiple commands to the same button.
The initial script I am working with is:
on (keyPress "<Down>") {
import mx.transitions.Tween;
import mx.transitions.easing.*;
var xPosT:Tween = new Tween(high, "_y", regular.easeOut, -234.8, -186.8, 6, false);
}
[Code].....
To tell it that if the button is at -186.8 go to -135.6. So obviously I am having trouble using keyPress "<Down>" twice. What would be the best way to approach this? I would like to have numerous keyPress "<Down>" and keyPress "<Up
View 12 Replies
Dec 6, 2009
I'm trying to apply a tween fade in effect to 3 objects, it's hard to explain but here's what i have
function goDown2(e:MouseEvent):void {
var tweenfadeIn:Tween = new Tween(graphic_btn, "alpha", None.easeOut, 0, 1, .1, true);
[Code]....
I wanna apply this tween to illustration_btn, and resume_btn
View 3 Replies
Nov 23, 2010
In CS5, I want to create a series of buttons that when clicked will linked to other frames in the same timeline. So one button will link to frame 5, one will link to frame 10, one will link to 15, etc. All the buttons will appear across the top of the stage on a layer, and I want them to appear on all of the frames so the user can click back-and-forth to the different frames/screens.
1. Is the best way to do this to just add the buttons to frame 1 and add a keyframe to the last frame in the timeline, frame 15, so they are copied to all the frames in between?
View 4 Replies
Feb 6, 2011
I made a flash banner + have photo creds on each photo. I want to make it a link to source to the photographer's portfolio.I've got 5 links for 5 buttons, button1, button2, button3, etc, each is named in the library with a matching name for the instance.I got the link working for the first image, but whenever I try and do it for others I keep getting a message of [code]
View 1 Replies
Dec 17, 2011
I have a problem creating multiple mc's and adding multiple images inside each mc.This code will add all the images inside last movieclip.
Actionscript Code:
for (var i = 0; i<myXML.box.length(); i++) { var _box = new box(); _box.name = "box"+i.toString(); _box.y = _box.height *i + 200; mcArray[i] = _box;
[code]....
View 2 Replies
Jun 3, 2011
I am building a Custom Image Picker, that shows 6 alternative versions. However the photo is only showing on the 6th item.
_model.selectedPhoto returns a Sprite, and does not let the app function correctly.
However when I use _model.photos[ii], A photo is added to each item - Why is this? I need to add _model.selectedPhoto to each s:Sprite
for (var ii:int; ii < 6; ii++)
{
//Create BG
var s:Sprite = new Sprite();
[Code]....
View 2 Replies
Oct 18, 2010
URL]
What I would like to do is add a paragraph of text describing each photo in a different text field. Im not really sure how I would do this. I assume I would add another txt field in flash and set it to dynamic. I would then give it an instance name. Im not sure how I would implement it into the xml or AS though. I know its quite simple but ive been trying for awhile now.
ActionScript Code:
function loadXML(loaded) {
if (loaded) {
xmlNode = this.firstChild;
[Code].....
View 2 Replies
Apr 2, 2009
I am working on application similar to [URL] how to add multiple clipart to the center rectangle. I can add one clipart but then adding second clipart/image replaces the first one.
View 1 Replies
Oct 17, 2009
i'm trying to add movieclips to a single mask. but i cant seem to get it to work.
is there a easy way to do this? or do i have to remove the mask-child and add a new one again?
View 2 Replies
Mar 7, 2012
Basically I have 5 movieclips I want positioned around the stage. So I figure the best way to this is with a for loop. However the way I've coded it doesn't appear to add new movieclips and seems to just move the first movieclip 5 times and it always ends up with an x of 169. Here's my code:
Code:
for (i=0; i<5; i++){
var barName:MovieClip =
_root.game.attachMovie("butSquare","r1wBar"+i,_root.getNextHighestDepth());
[Code]....
View 1 Replies
Mar 12, 2009
It is action script 3. As of right now I have a button that plays a song and I have a button that stops a song. The music plays as soon as the file is open. What I am trying to do is upload 3 more songs and add a skip button that will skip to the next song.After the user clicks 4 times it goes back to the 1st songs again.I was going to avoid using a pause, a step back to previous song button and a volume slider. [code]!
View 3 Replies
Dec 17, 2011
I have a problem creating multiple mc's and adding images inside each mc. This will add all the images inside last movieclip...
[Code]...
View 2 Replies
Jun 14, 2010
I understand how to import a swf and add it to the stage. Is it possible (using code) to add the one imported swf to the stage multiple times, each with different instance names? So the same as adding a library item to the stage multiple times, each time with a different instance name, with code, but using an imported swf?
View 1 Replies
May 11, 2011
for instance I have head or tail game. a coin first comes to the screen as head or coin not visible. but program has assigned already for its a game. and I have two buttons, head and tail. it asks head or tail. I push one of the buttons. (up to here I can handle all the codes). but now if I guess it true, I want the program to ask it again. (I can also handle the code up to here, if I push the timeline for example 100 key frames, as knowing 100 over and over is almost impossible).
But by which code I can make the test continue Without multiple keyframes.
View 4 Replies
Oct 4, 2009
i have an application in which i have around 100 textinputs all are numbers
i want to simplify the addition ie. any other way than saying txt1.text+txt2.text.....
that would increase my code a lot
is it possible to have (n+=txt*.text) or some thing like that
View 1 Replies
Jun 6, 2011
I'm creating a game in ActionScript 3.0 using the FlashPunk game engine and the FlashDevelop SDK. I've created my own MovieClip class that takes a preloaded movie clip file.
public function MyMovieClip(file:MovieClip, posX:int, posY:int, frameRate:int)
{
movieClip = file;
[Code]....
The problem that I'm having is that when I have multiple instances of the MyMovieClip class using the same swf file, only the last instance is rendered and is updated for each instance of the class that I have.(e.g 3 instances of MyMovieClip, the last instance is updates at 3 times the speed.)
View 2 Replies