ActionScript 3.0 :: Class Using A Loop To Target Mc's On Stage

Oct 9, 2010

i have 3 check box's and input text fields on stage that i would like to null out using the reset button however i seem to be targeting the objects incorrectly as i am getting this error:

Error #1009: Cannot access a property or method of a null object reference.

Code:
package
{
import flash.display.*;
import flash.events.MouseEvent;

[Code].....

View 4 Replies


Similar Posts:


ActionScript 3.0 :: Target Object On Stage From Within Class?

Nov 21, 2009

I have a custom class which uses some buttons on the stage. Or at least is trying to.say have this code in the customClass.as file

package{
import flash.events.*;
import flash.display.MovieClip

[code].....

View 5 Replies

ActionScript 3.0 :: Target Movieclip On The Stage From Custom Class

Dec 18, 2010

this is the code  and the movieclips are target1_mc & target2_mc
  
package {    import flash.display.MovieClip;    import flash.events.MouseEvent;    import flash.text.TextField;
public class recipeMC extends MovieClip {

[Code].....

View 1 Replies

Actionscript 3 :: Target Movie Clip On The Stage From Doc Class?

Dec 17, 2010

I am making dynamic drag and drop game.I have a class for the dragged items containing the drag drop code.My problem is I can't call/access the movie clips I've already put on the stage in my hit test statement.Here is my code and target1_mc & target2_mc are the existing movie clips on the stage:

package {
import flash.display.MovieClip;
import flash.events.MouseEvent;

[code]......

View 1 Replies

Actionscript 3.0 :: Target Movieclip Instance On The Stage From Class File

Dec 12, 2009

me only still learning as3, i've checked google there and back, but somehow i can't find the answer for this: how to target a movieclip instance which is already on the stage from within a class file? i mean, targeting it from the document class file is easy, but what is i want to target it from another class file?

View 2 Replies

ActionScript 3.0 :: Class Can Add The Rectangle To The Root Stage Without Requireing The Instantiated Class To Be Added To The Stage?

May 3, 2010

I have a class called shapeC that only creates a rectangle and then addChild(rectangle);.  That class is instantiated on the main timeline.  Currently, the only way you can see that rectangle is to add the instantiated class to the stage via addChild(shapeC);.  My question is, is there a way that the shapeC class can add the rectangle to the root stage without requireing the instantiated class to be added to the stage?

View 4 Replies

ActionScript 2.0 :: Target The Previous MC In A For Loop?

May 13, 2006

How do you target the previous MC in a for loop. Basically I am attaching MC's to the stage that are 90 Pixels apart from the top and bottom. I want to check the _x location of the previous MC and move in 90 pixels. Use an If statement so the _x location is not beyond 260 and if it is it moves _y 90 pixels and resets the _x. Is this the best way to do it.

[Code]....

View 4 Replies

ActionScript 2.0 :: Target Button In A Loop?

Jun 27, 2007

I have the below code which attaches a movieclip "btn1" to another movie clip within this loop I wish to setup up different functions for each different button but it only lets me set them up for the last one in the line of buttons. How to I target each button seperatly by using a string and then the value of miniLoop? i.e

subnav.test_mc.item1
subnav.test_mc.item2
code--------------------------------

[code]....

View 3 Replies

ActionScript 3.0 :: Reference An Event Target In A Loop?

Jun 17, 2009

Is it possible to reference an event target in a loop, something like the following?How do I reference the Thumb1 object?

Code:
if(event.target == Thumb1){
trace("yes");
}

[code]...

View 1 Replies

ActionScript 3.0 :: Target A Specific Button Set Up From Loop?

Jan 30, 2011

I'm working on a small project right now, and it consists of three toggle buttons that control various displayed data. I'm trying to make another toggle button, that once selected, will set the three existing toggle buttons to their "on" state. I'm pulling my hair out trying to target these individually through a loop. I'm currently working in the "//Begin Turn All On" section.

Code:
//New Button Collection Embedded in Movie Clip mc"buttonCollection"
var myBtns:Array = [buttonCollection.button1,buttonCollection.button2,buttonCollection.button3]; //Put all your buttons here

[Code].....

View 1 Replies

ActionScript 3.0 :: Loop AddChild Then Target To Add To Top Of DisplayList?

Jul 18, 2009

I am just trying to grasp a simple concept of utilizing loops, addChild, and eventListeners.My goal is to use a loop to create multiple instances of the same type of object from my library (called Ball), and when one is clicked, have it move "above" all other instances on the stage (and eventually drag, but that's easy enough to make happen later).My current code attempt is:

for(var i:uint = 0; i<=10;i++)
{
var my_ball:Ball = new Ball() //new instances of Ball from library export

[code].....

View 2 Replies

ActionScript 3.0 :: Removing E.target From Stage?

Jun 10, 2009

I've got a project with a bunch of stuff floating around the screen (enter_frame moves them all around). I instantiate them with one function, and I want to have them removed in a separate function (all timeline code, no .as files). I want them to remove themselves after floating 500 px off screen. Here are the two I've tried:

for (var i:int = 0; i < this.numChildren - 1; i++)
{
if ((getChildAt(i).x < -500 ||

[code]......

View 2 Replies

ActionScript 3.0 :: Target MC On The Stage Using The Linkage Name?

Oct 10, 2011

I'm creating an interactive time line, which for our purposes now will consist of flags and poles. The flags will just contain information like "December 2004" for example. The flag MC has a linkage name of ABFlag, and for each instance of it dragged onto the stage, the pole is dynamically drawn.The problem that I'm having is that I would like to be able to target all instances of the flag that are on the stage from an external class (not the document class), and I don't want to add instance names to all the flags. Is there any way that I can target movieclips that are on the stage using their linkage name instead of naking instance names? I do not have the option of placing these flags on the stage dynamically.

View 2 Replies

ActionScript 2.0 :: Target This MovieClip That Loaded Onto The Stage?

Nov 5, 2006

I'm trying to target a .swf that I loaded into a movie clip (mc_container) but it seems like I'm missing something. Can you take a look and see where I went wrong?

Code:
mc_container.loadMovie("mc_photoSwap.swf");
//homepage Animation Swap Images
function photoSwapAni(){
switch(random(3)){

[Code]...

Also I see I'm going to have an issue with the random part because it could call the same animation twice or more times in a row. Should I ad some sort of if statement or is there a better way to do this random part of the code?

View 10 Replies

ActionScript 3.0 :: Can't Target Main Stage From Dynamically Loaded Swf?

Jul 30, 2010

A part of the Flash app. I'm working on right now does the following -Main stage loads an external swf using the following function:

function loadAsset(evt:String):void{
var assetName:String = evt;
if (assetName != null){

[code].....

View 25 Replies

ActionScript 3.0 :: Flushing Loaded Swfs From Stage Target Mc?

Oct 18, 2011

I'm using buttons to send the playhead to frames in which swfs are then loaded into an otherwise blank movieclip called "stage_target_mc" ...how can I then flush out the previously loaded swf so only a newly loaded swf displays in "stage_target_mc"?For example, after clicking upon the 'about' button the 'about' swf loads...then if the 'concepts' button is clicked the 'concepts' swf loads -- but the previously loaded 'about' swf still plays...I would like to be able to flush the 'about' swf so only 'concepts' is display, in this example.code associated with buttons used to send playhead to frames "concepts" or "about":[code]

View 1 Replies

Actionscript 3.0 :: Footprint Of Listeners After Target's Removal From Stage?

Mar 27, 2011

Does the impact of event listeners on resources persist after their targets are temporarily removed from the display list? What about when mouseChildren is set to false for their container?

View 2 Replies

ActionScript 2.0 :: Target Mc In Specific Frame Of Main Stage?

Dec 9, 2003

I have two movie clips on the main stage: mcNav and mcContent1 (mcContent1 is located in the 2nd frame).

When I click btn1 which is a movie clip within mcNav, I want to go to the 2nd frame on the main stage where mcContent1 is located.

And then go to frame 10 within mcContent1 and stop.

Here's what I have:

btn1.onRelease = function() {
_root.gotoFrame(2).mcContent1.stop(frame 10);

View 2 Replies

ActionScript 3.0 :: Stage RemoveChild (Target) Not Working As Expected

Nov 7, 2009

I'm new to AS3 and have been making a Snake game. I've come up with a problem with the code (Yes, I have magically created problems trying to program Snake...It's going to be a long day). My problem is, with removeChild...I'm getting strange errors being throw at me. Not only that, but my Movieclip (myFood) is not being removed entirely, only the visuals of it are.

That being said, here is, what I believe to be, the most important chunk of code for this problem, along with the error it gives me.
Code:
/*
* Code for the Snake and whatnot extras.
* Also, Snake and Food are classes.
*/
var myFood:Food = new Food();
stage.addChild(myFood);
function snakeEatFood() {
[Code] .....

View 2 Replies

Professional :: TLF Target Instance Name From Class

Jun 10, 2010

I am trying to target a TLF Textfield within a movieclip from that movieclips custom class, but the class can't find the instance name. When I trace out the child name it comes up with a random instance name, not the instance name I set on the stage. When I try and target it from the movieclip's timeline it works fine. Is there a class I need to include in my custom class, or is this a bug? I would love to move from dynamic text fields to TLF, but this is a big hurdle.

View 10 Replies

ActionScript 3.0 :: Target Parent Of A Class?

Oct 2, 2009

I am trying got get the parent of a class so I can set a variable. first I problem I have is I cant even trace parent. I have a simple class nothing in it except a trace(parent) I instantiate it on the main timeline of a fla and it returns null. I have tried to trace root and it returns null as well. the class extends movie clip or sprite

View 7 Replies

ActionScript 3.0 :: Target A Function In One Class From Another?

Apr 29, 2010

i'm trying to target a function in one class from another. i'm able to call the function using(public static function imagecount()) but i can't a variable out side of that function. when i do i get this error:

1120: Access of undefined property _imagecount.

so below from call 'person' i want to call fucntion 'imagecount' in class 'model'. the call works but when i try and define a variable in class 'model' that is incremented in the 'imagecount' function i get the above error. it seem that my function has to be of type public static to be accessed from the other class.

///////////////// model class
package com.model
{
import flash.events.*;

[Code]....

View 3 Replies

Actionscript 3 :: Set Zoom On Mouse Click Target To Center Of Stage?

Aug 24, 2011

I'm having toruble with an image that I zoom into in flash. I got everything to work, only I want the clicked X and Y coordinats to center to the stage. ( so that the area clicked on always zooms in and position the area clicked to the middle of the stage) the image is a movieclip and it zooms with a tween, but i tried everything but the image wont center the stage..

does anyone have a clue for wich actionscript 3 code I can use to do this?

my code is:

const TWEEN_IN:String = "tweenIn";
const TWEEN_OUT:String = "tweenOut";
var tweenDirection:String;

[Code]....

View 1 Replies

ActionScript 2.0 :: Target Things On My Main Stage Based On The Preloader Swf?

Jan 1, 2004

I have a looped sound and some components in my main movie (scroll bar) which for some reason is really bogging down my swf and causing the preloader bar not to show up until like 46% or something ridiculous.So I am trying to solve the problem by having a preloader swf as suggested by Kode in this thread. However, now all my targeting is messed up in my main movie. Everything that was _root has to change but I can't tell what to load it into. I tried using _parent, _parent._parent, _root.container_mc (which is a blank movie clip created in the preloader swf that main is loaded into after the preloader is 100%) and others but nothing works. Even the simple looped sound which was originally just _root.backsound.start(0,999) can't be targeted.how to target things on my main stage based on the preloader swf?

View 14 Replies

ActionScript 3.0 :: Target Movieclip From Document Class?

Dec 17, 2010

i am making a drag drop game. i created a doc class for the dragged items . i want to make the hit test with some movie clips on the stage but inside the class they are not seen by there names. how to perform my hit test

this is my code,and target1_mc &target2_mc are movie clips on the stage

package {
import flash.display.MovieClip;
import flash.events.MouseEvent;
import flash.text.TextField;

[Code].....

View 5 Replies

Falsh :: Target MovieClip From Non-Document Class?

May 11, 2010

is there any way to target a MovieClip from an external class that's NOT the Document Class?

Is it correct to have the Document Class as Main AND View?

View 1 Replies

ActionScript 3.0 :: Target MovieClip That Class Extends?

Jun 22, 2011

Is there any way to get the name of the MovieClip that a class extends?Lets say I have an MC on stage called boxMC exported for AS using a class box which extends MovieClip.If I trace (this) within my class I will get the name of the class, if I trace (parent) I will get the name of the main MovieClip that boxMC sits within. So how can I target boxMC?Basically I want to be able to return the name of the MovieClip that the class is extending

View 2 Replies

ActionScript 3.0 :: Using Tween Class With A Moving Target?

Feb 15, 2009

Does anyone know whether it is possible to create a Tween object where the finish property is based on a changing variable?_tween = new Tween(object, "x", Regular.easeInOut, object.x, movingTarget.x, 60, false);The idea is that finish position could be updated with each frame so that the object changes direction in the middle of the tween.I don't know if this is possible (or even desirable)

View 4 Replies

Actionscript 3.0 :: Make The Arrow2, Body And Target Move To The Left Of The Stage

Sep 28, 2009

i have a loop error where it times out

Code: Select allstage.addEventListener(MouseEvent.MOUSE_DOWN, shootArrow);
function shootArrow(event:MouseEvent):void
{
do
{

[code]...

So what im trying to do is make the arrow2, body and target move to the left of the stage and make the actual arrow (flyingArrow) to move down to give the effect of a flying arrow?

View 3 Replies

ActionScript 3.0 :: Target/control .fla Movieclip From .as Class File?

Jun 18, 2009

I have a Bullet class - which defines and controls the firing of bullets (and works perfectly in all ways) - and now I'd like to add to it the ability to detect if it has hit a spaceship-movieclip sitting in my main .fla's timeline - what's the proper syntax to do this?

here's my code:

Code:
public function moveBullet(e:Event): void {
this.y = this.y - 20; // moves bullet up-screen, shooting vertically
if (this.y <= 0) {

[Code].....

View 8 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved