Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Flash








In MapMC.getChildByName(profileDot+i+.x); Correct?


ActionScript Code:
mapMC.getChildByName(profileDot+i+.x);


I get confused where to put the speech marks




KirupaForum > Flash > ActionScript 3.0
Posted on: 12-16-2008, 05:49 AM


View Complete Forum Thread with Replies

Sponsored Links:

Help Using GetChildByName
On the main timeline there is movie1, and in movie1 there is movie2. How do I tell movie2 to play from the main timeline?

I've got: flashhome.getChildByName("pics")as MovieClip.gotoAndPlay(2);

and I get the following error:

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

View Replies !    View Related
GetChildByName
Hi --

I have a series of text input objects and I would like to retrieve their
text value using the "getChildByName()" function like this

trace(getChildByName('FIRSTNAME').text)

However, I get a complier error "Access of possibly undefined property
thought a reference with a static type"

How can I refer to this objects and retrive the text?

Thanks

Rich

View Replies !    View Related
GetChildByName With Scene
Hi,
I created an interactive application using flash + ActionScript.
Now I added a preLoader as a first scene. Once I load everything, I use gotoAndStop(1, "app") to move to the main scene, where my application is.
My problem is that now I can't access the instances in my app.
Flash doesn't assign them automatically to the variables with the same name anymore.
Also, getChildByName("InstanceName") returns null.
What went wrong?

Thanks!

View Replies !    View Related
GetChildByName Problems...
i have a circle on the display list called "cir1" and its an instance of Circle_M, however when i track it down with getChildByName("cir1") its returned as DisplayObject rather than Circle_M. anyone know how i can convert it back to Circle_M?

View Replies !    View Related
Problems With GetChildByName()
I'm trying to use XML to load in 4 images to a movieclip within a movieclip that is already created on the stage. I'm trying to do this in a loop since there are 4 movie clips I'm trying to access. I can get it working without the loop, but it's figuring out the syntax that's causing the problem. Currently I have the following code:

function ParsePics(picsInput:XML):void {
var picsList:XMLList = picsInput.pic.image;
for (var i:int = 0; i < picsList.length(); i++) {
var picsElement:XML = picsList[i];
var imageURL = "images/stories/homeflash/" + picsElement;
var loader:Loader = new Loader();

var pic_mc = pics.getChildByName("pic" + (i+1));
pic_mc.addChild(loader);
loader.load(new URLRequest(imageURL));
}
}

The line causing the issues is var pic_mc = pics.getChildByName("pic" + (i+1));
I'm not sure how to access all 4 movieclips - pic1, pic2, pic3 and pic4 without preforming the step 4 separate times. any ideas on what I'm doing wrong?

View Replies !    View Related
GetChildByName Crashing Cs3
I am building an array that attaches listeners to subclips on the stage. The problem is when I test it, it crashes cs3

The situation is this: I have a number of clips (currently two but it will be 40) on the stage. These are named hum1 and hum2. Each of these clips has a subclip called sound. I want to use an array to attach listeners to the sound subclip of all 40 clips that will eventually be on the stage.

hum1->sound
hum2->sound

code:


ActionScript Code:
for (var i:Number = 0; i<2; i++) {
    var addedClip:Object = new Object();
    addedClip = getChildByName("hum"+(i+1));
    var soundSubclip:Object = new Object();
    soundSubclip = addedClip.getChildByName("sound");
    clipArray.push(soundSubclip);
    clipArray[i].addEventListener(Event.ACTIVATE, clipPlacer);
    clipArray[i].addEventListener(MouseEvent.ROLL_OVER, blurAndSound);
    clipArray[i].addEventListener(MouseEvent.ROLL_OUT, focusAndSilence);
}

When I run the above code, Flash CS3 stops responding.

If I use just the main clips (pushing addedClip instead of soundSubclip) it works fine.

View Replies !    View Related
Work Around For Getchildbyname
It is becoming clear that i (we) cant use:

getChildByName().getChildByName()... In a linear fashion?

Whats the work around, its odd if a var has to assigned to each one...

View Replies !    View Related
Problem With GetChildByName
i don't know what i'm doing here.

ActionScript Code:
for(var i:Number = 0; i < 3; i++){
        var bling:MovieClip = new buildbox("ericlogo.gif");
            stage.addChild(bling);
            bling.name = "dump"+ i;
            bling.x = 200 * i;
            trace(bling.x);
    }
trace(getChildByName("dump1"));

just traces out null.

the class just uses the drawing api to make a white square then loads an image into it. if i trace bling.name or bling.x in the for loop it's fine but when i try to use getchildbyname it goes to shit.

View Replies !    View Related
GetChildByName Questions
I'm creating text fields dynamically using:

// FOR LOOP
var newResult:TextField = new TextField();
addChild(newResult);
newResult.name = 'result'+resultNum;

The newResult text field has a bunch of default properties defined, like:

newResult.multiline = true;
etc...

The problem is, I'm trying to reposition each new result and it's not working. I'm using:

getChildByName('result'+resultNum).x = // MY MOVING EQUATION

What happens is the first result is moved to the last x-pos determined by the equation (+= inside a loop)

What am I doing wrong?

View Replies !    View Related
GetChildIndex And GetChildByName
after tracing the child indexes of my sprite, I get multiples of 2. Any reason why this happens? I also make an attempt to trace the child name but results show null.







Attach Code

var len:Number = 5;
for (var i:Number = 0; i < len; i++){
// Create a simple button and configure its location
buttons = new HoverButton(o[i].bgColor, o[i].hoverColor, o[i].pressedColor);
// Create the different states of the button, using the
buttons.y = buttons.height * i;
// Add Text
buttons.text = o[i].text;
// OUT PUTS AS 0, 2, 4, 6, 8
this.addChild(buttons);
trace(getChildIndex(buttons));
// OUT PUT COMES AS null, null, null, null, null
trace(getChildByName(buttons))

View Replies !    View Related
GetChildByName + Loader
What seemed logical to do is not working apparently.

I have four buttons named button_0...button_3 on the stage and compiled into assets.swf. Essentially, I want the layout to be handled by designers and placed on stage as it should appear. However, this old approach is giving me a trouble with AS3. Seems to be the problem with the Loader class allowed to have only one child. So how do you get access to the children of that child and its properties (such as x,y,etc.)? Any ideas?

Thanks

here's the code:
---------------------
public class Test {
var assets:Loader;
public function Test()
{
assets = new Loader();
assets.contentLoaderInfo.addEventListener(Event.CO MPLETE, completeListener);
assets.contentLoaderInfo.addEventListener(IOErrorE vent.IO_ERROR, ioErrorListener);
assets.load(new URLRequest('assets.swf'));
}
private function completeListener(e:Event):void
{
var loaderInfo:LoaderInfo = e.target as LoaderInfo;
var m:MovieClip= MovieClip(loaderInfo.content);
array= new Array();
for (var i=0; i<m.numChildren; i++)
{
array.push(m.getChildByName("button_"+i));
array[i].x = 50+150*i;
array[i].y= 100;
addChild(array[i]);
}
}
}

View Replies !    View Related
AS3 - How To AddChild Using GetChildByName?
Hi, I still have problem understanding how I should treat the getChildByName. I really hope some one can get help me through this understanding.

I have a class named Box and in there I have created a movieclip and named it like this.

var _bg:MovieClip = new MovieClip();
_bg.name = "bg_mc";

Now in another class which imports the Box class, I want to insert a Sprite (or a movieclip, no difference)

To add the needed Sprite, currBg, I'm doing this:

var myBox:Box = new Box();
var tmp:MovieClip = myBox.getChildByName("bg_mc");
tmp.addChild(_bg);

But it won't let me do this it keeps giving this error:

1118: Implicit coercion of a value with static type flash.displayisplayObject to a possibly unrelated type flash.display:MovieClip.

Any help please?

View Replies !    View Related
Papervision: GetChildByName
When a Collada object is loaded into the scene a the message "DisplayObject3D: exampleNameOfObject" is kicked up in the output window. I really, REALLY need to get my hands on this name and put it in a public variable to use in "getChildByName" listener functions. What is the AS to get the name of the object added to the scene?

I have tried in a "onColladaComplete" function to do this: "trace("OBJECT TITLE: " + event.target.name );"

View Replies !    View Related
GetChildByName().text ?
Hi,

I have a problem, I am craeting a textField with as3.0 then I am assigning a name:
Code:

myTextField.name = "myTextField" + i
the I try to reffer to it like this
Code:

getChildByName("myTextField"+counter).text = "something"
and I get an error "access of posibly undefined property text through a reference....."
What I am doing wrong? I tryed like this
Code:

getChildByName("myTextField" + letterCounter).text as TextField = myArray[letterCounter];

View Replies !    View Related
DuplicateMovieClip And GetChildByName Usage
I'm not having much fun transitioning from AC2 to AC3. Seems like EVERTHING is different and often harder.

What i want to do is duplicated an MC using the loop and then be able to refer to each particular movieclip and access and change the info inside. I'm getting this info from a mySQL database via remoting and amfphp.

I've read a bunch of threads on this topic but i'm still confused about how to duplicate movieclips so that I can refer to them uniquely and access the child MCs and textfields contained within.


Code:
for (var i:int = 0; i < result.serverInfo.totalCount; i++)
{

var newReview:IncomingReviews = new IncomingReviews();
newReview.name = "newReview"+i;
this.addChild(newReview);

newReview.y = newReview.y + 100*i;

newReview.title.text = result.serverInfo.initialData[i][3];
newReview.myDate.text = result.serverInfo.initialData[i][4];
newReview.url.text = result.serverInfo.initialData[i][5];

trace( "instance name = " + getChildByName("newReview"+i) );

}

View Replies !    View Related
GetChildByName Questions - Simple
I'm creating text fields dynamically using:

// FOR LOOP
var newResult:TextField = new TextField();
addChild(newResult);
newResult.name = 'result'+resultNum;

The newResult text field has a bunch of default properties defined, like:

newResult.multiline = true;
etc...

The problem is, I'm trying to reposition each new result and it's not working. I'm using:

getChildByName('result'+resultNum).x = // MY MOVING EQUATION

What happens is the first result is moved to the last x-pos determined by the equation (+= inside a loop)

What am I doing wrong?

View Replies !    View Related
Using GetChildByName For Objects Not On 1st Frame
Hi,

I have created a class that extends movieClip and created an instance of it on the stage. On the main timeline, I have two frames, with different objects on each frame (a textfield named txt on frame 1 and a button on frame 2 named btn, for example). Now, I want to define a reference to the object on frame to in my class constructor. For example,


Code:
package {import fl.controls.Button;
import flash.text.TextField;
import flash.display.MovieClip;

public class test() extends MovieClip {private var _button:Button;
private var _txt:TextField;

public function test() {this._button = this.getChildByName("btn") as Button;
this._txt = this.getChildByName("txt") as TextField;
}
}
}
When this is compiled, I get an error to the effect:"TypeError: Error #1009: Cannot access a property or method of a null object reference.", which I believe refers to my attempt to get a reference to the btn object. Does anyone know how to get around this? Thanks in advance.

J

View Replies !    View Related
GetChildByName() Issue With Loop
I'm trying to use XML to load in 4 images to a movieclip within a movieclip that is already created on the stage. I'm trying to do this in a loop since there are 4 movie clips I'm trying to access. I can get it working without the loop, but it's figuring out the syntax that's causing the problem. Currently I have the following code:

function ParsePics(picsInput:XML):void {
var picsList:XMLList = picsInput.pic.image;
for (var i:int = 0; i < picsList.length(); i++) {
var picsElement:XML = picsList;
var imageURL = "images/stories/homeflash/" + picsElement;
var loader:Loader = new Loader();

var pic_mc = pics.getChildByName("pic" + (i+1));
pic_mc.addChild(loader);
loader.load(new URLRequest(imageURL));
}
}

The line causing the issues is var pic_mc = pics.getChildByName("pic" + (i+1));
I'm not sure how to access all 4 movieclips - pic1, pic2, pic3 and pic4 without preforming the step 4 separate times. any ideas on what I'm doing wrong?

View Replies !    View Related
Urgent Help With GetChildByName And Sub Movieclips
I' have a "for" that adds a bunch of stuff to my stage, and I need to add some actions to items that are on the attached MC. So I'm trying to use "getChildByName". And for the most part if I target just the item by using getChildByName("item+j) I have no problem. I can attach the eventlistner. BUT is I try to target a sub movieclip I get an error. For example
getChildByName("item"+j).addEventListener..... works
getChildByName("item"+j).thumb1.addEventListener.. .. does not work.

I could really use some help here.

typically if I needed to add an eventlistener to a sub movieclip I could just target it.
item1.thumb.addEventListner... But for some reason I can't get it to work when trying to access through getChildByName. I've tried

(getChildByName("item"+j) as MovieClip).thumb doesn't work.

I need help. Please Anyone

View Replies !    View Related
AS3 - GetChildByName For Objects Not On 1st Frame
Hi,

I have created a class that extends movieClip and created an instance of it on the stage. On the main timeline, I have two frames, with different objects on each frame (a textfield named txt on frame 1 and a button on frame 2 named btn, for example). Now, I want to define a reference to the object on frame to in my class constructor. For example,


Code:
package {
import fl.controls.Button;
import flash.text.TextField;
import flash.display.MovieClip;

public class test() extends MovieClip {private var _button:Button;
private var _txt:TextField;

public function test() {this._button = this.getChildByName("btn") as Button;
this._txt = this.getChildByName("txt") as TextField;
}
}
}
When this is compiled, I get an error to the effect:"TypeError: Error #1009: Cannot access a property or method of a null object reference.", which I believe refers to my attempt to get a reference to the btn object. Does anyone know how to get around this? Thanks in advance.

J

View Replies !    View Related
AddChild, GetChildByName, RemoveChild
This script should load an Image put it in "phClip" movieclip and remove it ... what's wrong?

Code:

   var imageLoader:Loader = new Loader();
   var pic:URLRequest = new URLRequest(url);
   imageLoader.load(pic);
   imageLoader.name = "selected_pic";
   MovieClip(phClip).addChild(imageLoader);
   var target:DisplayObject =  MovieClip(phClip).getChildByName("selected_pic");
   removeChild(DisplayObject(target));

View Replies !    View Related
New To AS3..Instance Name | GetChildByName | RemoveChild |
Here is what I am trying to do. I have a empty movie clip on the stage called mcThumbs. I am attaching movieclips from the library and naming the instance name 'thumb0', 'thumb1', 'thumb2' and so on. After I attach a thumb, I want to attach a preloader inside on the thumb0, thumb1, thumb2 ect. After all that is done, I want to click on a button that I have on the stage called mcTest. When that button is clicked, I want all of the preloaders are removed.

FYI: The preloader is a simple animation, so I think it has to be a movieclip and not a sprite (if that matters)



Code:

var tnSpacer:Number = 50;
var btn: Thumb;
var mcPreload:CircleLoader;

function loadThumbs():void {
   for (var i:Number =0; i<galleryArray.length; i++) {

      btn = new Thumb();
      btn.name = "thumb"+i;
      mcThumbs.addChild(btn);
      trace(">"+btn.parent.name);


      mcPreload = new CircleLoader();
      mcPreload.name = "mcPreloader";
      btn.addChild(mcPreload);
      trace(">>" + mcPreload.name);
btn.x = (tnSpacer*i);
   }
}

mcTest.addEventListener(MouseEvent.CLICK, removePreloader);

function removePreloader(e:MouseEvent){
   for (var i:Number =0; i<galleryArray.length; i++)

   //What do I put in here to remove the preloader in each movieclip?
   //IN AS2 the path for the preloader would be mcThumbs["thumb"+i].preloader
   //How do I use that same technique to tell removeChild what to remove?
   
   //It is possible to do something like:
//mcThumbs.getChildByName("thumbs"+i).removeChild(mcThumbs.getChildByName("thumbs"+i).getChildByName("mcPreloader)?


   }
}



How Can I get the path to the preloader that I want to remove? I want to avoid using getChildAt(). I would like to do it using a instance name. Sorry. I am very very new to AS3 and I don't understand it completely.

View Replies !    View Related
Accessing Methods And Properties Via GetChildByName
Hi guys

I seem to be having a bit of a problem here.
I'm generating a load of class instances using the following code:

maxpersons=25;

for (var i:Number=1;i<=maxpersons;i++)
{
var person:Person = new Person;
person.name="person"+i;
game.addChild(person);
}


OK. I then need to run through each of them and check for a collision with an object from the main stage (called redDot), which I pass to a method (called doDamage) within the class. I'm using the following code:

for (i=1;i<=maxpersons;i++)
{
if (game.getChildByName("person"+i).hitTestObject(red Dot))
{
game.getChildByName("person"+i).doDamage(redDot);
}
}

I keep getting an error saying "1061: Call to a possibly undefined method doDamage through a reference with static type flash.displayisplayObject."!

It just won't work. I've tried altering the code to:

game["person"+i].doDamage(redDot);

but I get an unexpected trace output saying "TypeError: Error #1010: A term is undefined and has no properties."

Maybe I'm going about it the wrong way. Can someone please shed some light on this, cos I haven't got a clue whats going on! Thanks!

View Replies !    View Related
GetChildByName() Returns Null When It Shouldn't
I'm dealing with a mystery where symbol instances are not being found by getChildByName() when I return to the previous frames where they first appear. getChildByName() finds them the first time, but not when returning back to those frames. Working in AS3.0. Here's a little more background:

I'm creating a flash game where you can walk around 10 different rooms. Each room has its own background. And each room can have either one or two doors, which lead to other rooms. The whole game takes place in a single frame in the main timeline.

So very simply, I have a movieclip symbol called "backgrounds", and its timeline has 10 frames containing all the room backgrounds. Also I have a symbol called "door" which I'm nesting inside the frames of the backgrounds. For example, in frame 1 of "backgrounds", I've manually placed two "doors". I've named the door instances "door1" and "door2". Likewise in all the other background frames, I similarly manually position one or two door symbols and also name their instances "door1" or "door2" so that my code can work universally with doors.

Now here's the part that has been driving me insane for about 4 days and you're probably a flash genius if you know the answer: I simply use backgrounds.gotoAndStop(x) to jump to the correct background for the given room. When I go forward with gotoAndStop, I can access the door instances with no problem. But when I go backwards to previous frames that were already displayed, the door instances can no longer be found by getChildByName(). The doors are displayed on screen, but you can't retrieve them even by door1.background. Example: frame 1 of backgrounds has just "door1" instance. I now do backgrounds.gotoAndStop(2). Frame 2 of backgrounds has just a "door2" instance (both instances the the "door" symbol). If I now do backgrounds.gotoAndStop(1), now backgrounds.getChildByName("door1") returns null even though you can see that door on the background! It's as if the door instances are not being reinitialized when I go backwards with gotoAndStop. By the way, I'm just accessing the door instances to do collision detection with the doors such as myCharacter.hitObjectTest(backgrounds.door1) for example.

Any insights enormously appreciated!

View Replies !    View Related
Accessing Children Of Movieclips With GetChildByName
ok. so i'm trying to access a movieclip inside of a movieclip and adjust it's opacity.

ie:


ActionScript Code:
getChildByName("blah").information.alpha = 0.50;

i just get an "access of possibly undefined property information through a reference with static type flash.displayisplayObject"

it works just fine when i do it directly


ActionScript Code:
blah.information.alpha = 0.50;

i'm confused.

View Replies !    View Related
GetchildByName = False Even Though Child Exists
ActionScript Code:
function abc() {
            var _mc:MovieClip = new MovieClip()
            this.addChild(_mc)
            if (this.getChildByName("_mc")) {
                trace("REMOVING OLD CLIP");
            }
            else {
                trace("NOT FOUND");
            }
        }

I have also tried replacing "this" with "stage".
Does anybody have any idea why this keeps returning "NOT FOUND"?

View Replies !    View Related
GetChildByName() Problem: 1118 Error
Hi,

I'm dynamically generating a row of buttons.
My code for this looks like this:


ActionScript Code:
//make buttons
var mc:MovieClip = new butt();
mc.addEventListener(MouseEvent.CLICK, onClick);
mc.name = "clickbutt"+i;
addChild(mc);

Now I want to change the properties of a certain button at runtime.
Using getChildByName() or getChildByID() I get a 1118: Implicit coercion of a value with static type flash.displayisplayObject to a possibly unrelated type butt.

My code looks like this:

ActionScript Code:
var target:MovieClip = getChildByName("clickbutt"+i);
target.buttonMode = true;

I'm lost...... anyone?

View Replies !    View Related
Problem With Goto When Calling GetChildByName
hi, I am using new to duplicate a movie clip (blabla). Works fine for .x , .y , etc but when I try gotoAndStop(11), with all the necessary code within that MovieClip, it fails.

Code is as shown below:

import flash.display.*

var posX:int = 0;
var testing = new Array();
for (var i:uint=0;i<10;i++) {
var blabla = new Symbol1();
blabla.x = posX;
posX += 10;
blabla.name = "b" + i;
testing.push(blabla);
addChild(blabla);
}

trace(getChildByName("b5") is MovieClip)
//this can work
getChildByName("b5").x = 300

/*this cannot work, gives error:
1061: Call to a possibly undefined method gotoAndPlay through a reference with static type flash.displayisplayObject.
*/

getChildByName("b5").gotoAndPlay(20);

Please help!! Thanks!

View Replies !    View Related
Problem Getting Name Of Dynamic Button Using GetChildByName
I am new to flash/actionScript and I am hoping some one could be kind enough to help me out... {I am using AS3}

I am having trouble with my navigation.

I create my navigation button like this

var btnLabel:String = labels[i]; //labels is an array i have set up that lists the different nav choices
label = b.getChildByName("label_txt") as TextField;
label.text = btnLabel.toUpperCase();
b.addEventListener(MouseEvent.ROLL_OVER, overEffect);
b.addEventListener(MouseEvent.ROLL_OUT, outEffect);
b.addEventListener(MouseEvent.CLICK, bClick);
b.mouseChildren = false;

label is a variable that I have listed out side of the function. this is just where i set it. so my problem is that when i try to get it to load a movieClip when it is clicked. I would assume you can tell it to grab the label.text which should give you the name that is associated with that button. then I would assume you can grab the text for the button later when it is clicked on. so i am trying to set up the function to load another movie clip when the button is clicked on. this is what i have so far

function bClick(e:MouseEvent):void {
var labelTF:TextField = e.target.getChildByName("label_txt") as TextField;
var lab:TextField = labelTF;

then i add a trace to just see what it is giving me.

trace (lab);

so my problem is it is giving me this as my trace output.

[object TextField]
[object TextField]
[object TextField]


how do I get the name of that button?? I would think that once i got that name i could finish the function and have it load the new movie clip. but i am not able to get that button name. I have tried changing the e.target to be more specific to the button and made it b.getChildByName() and I have also tried b.label.getChildByName() but that didnt change my results and gave me errors. I have also tried changing the label_txt part to try the different variables like label, btnLabels and even labels.text. All gave me the same thing or errors.

can you tell me what i am doing wrong?


thanks,

View Replies !    View Related
For Looping Dynamic Movieclips GetChildByName() OnEnterFrame HELP PLEASE
Hey All. Thanks for reading..

I built something some time ago in AS2 and now I'm trying to convert it into AS3, but I can't get a
hold of the dynamic movieclips; I keep on getting errors. Here is the original script in AS2:

Code:
this.onEnterFrame = function() {
for (var i = 0; i<10; i++) {
var xxm:Number = this["mc"+i]._xmouse;
}
}

And I've been trying it a number of different ways in AS3, but can't get it - either wrong or errors..
I've tried things like:

Code:
this.addEventListener(Event.ENTER_FRAME, test);
function test(event:Event):void {
for (var i:uint = 0; i<10; i++) {
var xxm:Number = MovieClip(this.getChildByName("mc"+i)).mouseX;
}
}

But like I said... not working out...
Please help - how do I do this?
Thanks.

View Replies !    View Related
GetChildByName Doesn't Work Inside AS File
Hi,
I am trying to get an open source Flex project to work in Flash, and currently the main issue I am having is that getChildByName doesn't work for some reason when called from an AS file that doesn't contain a class.

I admit I still haven't quite figured out the relationship between the main document class and additional AS files and how they connect...

Here's the situation:

In the AS file (in the Flex version) an already existing MovieClip (created in the main document class using scripting, i.e. it's not put on the stage using the interface) is being put into a variable.
In Flash, I get the error
1180 - Call to a possibly undefined method getChildByName
when trying to get the same task done.
My code for this line is:
var myClip:MovieClip = getChildByName("theClip");
I know I'll probably have to type cast it into a MovieClip, but I don't even get to that point yet.
I made sure that the MovieClip "theClip" has a name "theClip", and in other projects this has worked just fine.

I import flash.display.* to have access to DisplayObject.

There's gotta be something about AS files that I don't know yet that makes them behave differently, but I need to be able to access that MovieClip from within the AS file.

Any ideas?

Thanks!

View Replies !    View Related
RemoveChild(getChildByName("whatEverName1"));
Hi All,

Look over the following code, look for the 'thumb.name = "thumb" + i; // here' line;

function xmlLoaded (e:Event):void {

xml = XML(e.target.data);
images = xml.image;

for(var i:uint=0; i<images.length();i++){
var thumb:MovieClip = new MovieClip();
var thumbLoader:Loader = new Loader();
thumb.x = 65*i + spacing;
thumb.y = 370;
thumb.src = images[counter].@url;
thumb.mouseChildren = false;
thumb.buttonMode = true;
thumbLoader.load(new URLRequest(images[counter].@thumb));
addChild(thumb);
thumb.name = "thumb" + i; // here
thumb.alpha = 0;
TweenMax.to(thumb, 1, {alpha:1, ease:Sine.easeIn});
thumb.addChild(thumbLoader);
thumbLoader.x = 24;
thumbLoader.y = -14;
thumb.addEventListener(MouseEvent.CLICK, clickedThumb);
counter++;

}
loader.load(new URLRequest(images[0].@url));

}


Now what I need is to provide a name that respresents all the "thumb" + i instances. So the one name would represent all the instances of "thumb" + i - Rather than having to use the following:

function fullScreen(MouseEvent):void
{
removeChild(getChildByName("thumb0")); // here
removeChild(getChildByName("thumb1")); // here
removeChild(getChildByName("thumb2")); // here
// Need one name to remove all names

stage.displayState = StageDisplayState.FULL_SCREEN;
masker.x=0;
masker.y=0;
masker.width=stage.stageWidth;
masker.height=stage.stageHeight;
StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;


}
masker.buttonMode = true;

How would I go about acheiving this? Any help really appreciated ;)

Kind Regards,

Boxing Boom































Edited: 10/08/2008 at 12:00:58 PM by Boxing Boom

View Replies !    View Related
Can Anyone Correct This .fla For Me?
I used the flashkit VR sample script to as my base for mouse-triggered movement of an image. But now everytime the mouse reaches an image-border, the image jumps back to the center of the image. What can I do about this? I want the movement to gently bounce in the opposite direction once an image border has been reached. Can anyone correct my flash_VR.fla and mail it to lausbaum@mac.com? I uploaded it to http://nikoflash.ontheweb.nl - I would be very very very thankful to anyone willing to help!

Thanx!!!

View Replies !    View Related
Is This Correct ?
Hello everybody

I just made a preloader at Scene 1, ofcourse i got other scenes, scene 2 scnene 3 etc.etc.

i want the repload movie go play scene 2 if EVERYTHING is loaded, including scene 2 scene 3 scene 3 etc.

Is this correct if i put on the beginnin or last frame of my preloading animation, scene 1 :

if frame is loaded, scene 3 frame xxx
go to and play scene 2 label/frame xx

thnx.

View Replies !    View Related
What's The Correct Way To Name This...
I need to call something like this...


Code:
_level100.member4._alpha = 100;
However, the "4" in member is the result from an array element so when I do something like this...


Code:
_level100."member" + _root.memkid[d]._alpha = 100;
I get an error: "Expected a field name after '.' operator."

So what is the proper naming convention to make this work. Thanks for any help here.

View Replies !    View Related
This Can Be Done... Correct?
I'm going out of my mind trying to rememmber how to fade in dynamic text. I have a swf that gets loaded into my master swf file.

the loaded swf file (lets call it "loaded.swf")cosists of 15 frames total on its root timeline. It has 4 layers (1 being solely for actions). on one of the layers I have placed a MC instance onto frame 2 (frame 1 has a small graphic tween). This MC instance holds a dynamic text field with an instance name of "loadedInfo". This container MC consists of only 1 frame total.My actions layer in this MC ahs the following code:



//-------------------<load CSS>-------------------\
var cssStyles:TextField.StyleSheet = new TextField.StyleSheet ();
cssStyles.load ("styles/styles.css");
cssStyles.onLoad = function (success) {
if (success) {
loadedInfo.styleSheet = cssStyles;
_level0.myLV.load("vars/problemText.txt");
} else {
loadedInfo.text = "There has been an error loading the requested information.";
}
}
//-------------------</load CSS>-------------------\

_level0.myLV.load("vars/problemText.txt");



Back on the parent timeline of loaded.swf i have the container MC (which hold my dynamic text field) do a motion tween with alpa values at 0% going to 100%.


*** PROBLEM *** I cannot seem to get this to work. I know i hhave read this somewhere before, but cant seem to find the help resources for similar problems people have resolved. Any help on this would be a huge pain reliver for this headache of a stump I have hit. Thanks.

View Replies !    View Related
Is There A More Correct OOP Way To Do It?
i have 2 classes (Ball & Level) and several instances of each class.
if i need a Ball instance 3 to call level_4. i use this messy code on Ball.as:


Code:
// myLevel is a Number <= number of level instances here 4;
//levelArrayAdd(); is a function on the level_4 instance
var levelHolder:Level = findMyLevelClass(myLevel);
levelHolder.levelArrayAdd(this);
and the function looks like this:

Code:
private function findMyLevelClass(leve:Number):Level {
var findL = levelFinder(leve);
Level(findL);
var levelHolder:Level= _root[findL];
return levelHolder;
}
private function levelFinder(levelIn:Number):String {
var lfind = ("level_"+levelIn);
return lfind;
}
this works, but it seems messy, is there a more correct OOP way to do it?

View Replies !    View Related
Is This Correct?
This is to make an "active state" for my buttons


invA_but._visible=false;
invB_but._visible=false;
invC_but._visible=false;
invD_but._visible=false;
invE_but._visible=false;
invF_but._visible=false;




a_but.onRelease=function(){
invA_but._visible=true;
invB_but._visible=false;
invB_but._visible=false;
invD_but._visible=false;
invE_but._visible=false;
invF_but._visible=false;
}

b_but.onRelease=function(){
invA_but._visible=false;
invB_but._visible=true;
invC_but._visible=false;
invD_but._visible=false;
invE_but._visible=false;
invF_but._visible=false;
}

c_but.onRelease=function(){
invA_but._visible=false;
invB_but._visible=false;
invC_but._visible=true
invD_but._visible=false;
invE_but._visible=false;
invF_but._visible=false;
}

d_but.onRelease=function(){
invA_but._visible=false;
invB_but._visible=false;
invC_but._visible=false;
invD_but._visible=true;
invE_but._visible=false;
invF_but._visible=false;
}

e_but.onRelease=function(){
invA_but._visible=false;
invB_but._visible=false;
invC_but._visible=false;
invD_but._visible=false;
invE_but._visible=true;
invF_but._visible=false;
}

f_but.onRelease=function(){
invA_but._visible=false;
invB_but._visible=false;
invC_but._visible=false;
invD_but._visible=false;
invE_but._visible=false;
invF_but._visible=true
}

View Replies !    View Related
How To Correct?
I am trying to create an interactive flash quiz using Adobe Flash CS3, however when i try to link the buttons to my dynamic text, i can't. It tells me that there is something wrong with my code. Can someone please tell me what it is wrong with my following coding?

stop();
on(release){
_root.answer1 = "Wrong Answer ";
}

View Replies !    View Related
Is This Correct?
I wrote:


Code:
for (i=1; i<=4; i++) {
eval("photo"+i).imgHolder.loadMovie(eval("img"+i), this);
}
I want:
photo1.imgHolder.loadMovie(img1,this);

is eval() the correct thing to use? It's working, but is it the most efficient? Thanks.

View Replies !    View Related
Please Correct Me
Hi
All
I llok through the forum and found script to move MC with elastic effect
but also want to scale that so i modify the script.


ActionScript Code:
function moveClip(mc,physics0,physics1, xvar, yvar, xscalevar, yscalevar){
        xspeed=yspeed=0;
        xscaleSpeed=yscaleSpeed=0;
        mc.onEnterFrame = function(){
                xspeed = ((xvar-mc._x)*physics0)+(xspeed*physics1);
                yspeed = ((yvar-mc._y)*physics0)+(yspeed*physics1);
                xscaleSpeed = ((xscalevar-mc._width)*physics0)+(xscaleSpeed*physics1);
                yscaleSpeed = ((yscalevar-mc._height)*physics0)+(yscaleSpeed*physics1);
                // add the speed to the current position of the object
                mc._x += xspeed;
                mc._y += yspeed;
                mc._width += xscaleSpeed;
                mc._height += yscaleSpeed;
                if(Math.abs(xspeed && xscaleSpeed)<=0.2 && Math.abs(yspeed && yscaleSpeed)<=0.2){delete mc.onEnterFrame;
                        mc._x=xvar;
                        mc._y=yvar;
                        mc._width=xscalevar;
                        mc._height=yscalevar;
                        }
                       
                       
        }}


But for some reason it works on first click and don't work on second
I mean if i have two button and each of them is told to move same clip to move and scale from on position to other then on first click it works fines but on second click on other button it just jump to mention position without any moving or elastic effect

please correct above script

Thanks

View Replies !    View Related
Correct Syntax For 'and'?
hello boardsters...

i have a preloader which is checking to see if an external txt file is loaded in, by checking for a variable named &eof at the end of it- but it also needs to check if a certain frame in the file is loaded.

so, my code so far says:

if (eof == 1) {
gotoAndPlay ("loaded");
}

how do i phrase it correctly? i want to say, "if eof is loaded, AND frame 20 is loaded, go to..." but i'm pretty sure i can't just stick and 'and' in...

a little help anyone?
cheers m'dears
louise

View Replies !    View Related
Btn In MC Not Doing The Correct Action
when i place a MC which has a Btn action inside it into one of my scenes and play it and then try to click on it it does not go to the correct location it just starts over that scene and stops (i have a stop action in the scene)

the Btn action is
on (press) {
gotoAndPlay ("Ackee", 1);
}

could the problem be that i can not put a Btn action in a MC and then try to access it.

help me..

Blessings...

View Replies !    View Related
Is My Preloader Correct
Can anyone tell me if this is right?
In my preloader the first frame of the first layer is blank. the actionscript looks like this (bLoaded and bTotal are 2 textboxes that say how many bytes are loaded:

var Loadd = getBytesLoaded();
var Total = getBytesTotal();
bLoaded = loadd;
btotal = total;
if (loadd=total) {
gotoAndPlay ("Main", 1);
}
;

the second frame is blank too and it looks like this:
gotoAndPlay(1);
the first frame of the second layer is a keyframe. it and the second frame have the loading movie with the textboxes. is that correct?

And the second question is why isnt my preloader loading. Since my file was small it thought the reason i never saw it was cause its only 2 frames long and it loaded fast, but now to test it out it added a 1 mgb sound file to the 3ed frame of the acutal site but the preloader still doesnt load and it just stops before the 3ed frame to load it. And in the scene box the Preloader scene is before the "Main" scene. if you need me to send you it to furture clarify i can. CAN ANYONE HELP?

View Replies !    View Related
This Has Got To Be Easy To Correct
check it out

http://www.ecomexpress.net







???? Its like a big maze ????

View Replies !    View Related
Not Sure If Script Is Correct?
Hi Guys,
Can anyone see any error with this script:


Code:
if (_root.Go ne "") {
if (_root.Success eq "Yes") {
gotoAndStop (1);
_root.Go = "";
Status = "Success Welcome to are Website";
_root.gotoAndStop("SomeRedirectFrame";
}
if (_root.Success eq "No") {
gotoAndStop(1);
_root.Go = "";
Status = "Please Login Again - we where unable to find your UserName";
_root.gotoAndStop(1);
}
}

// Only for last frame of Loop
else {
gotoAndPlay(2);
}

View Replies !    View Related
Correct Way To Use LoadVars ?
Is this coding incorrect? Do you HAVE to load variables into a seperate LoadVars object? Will it cause errors to load data into the same LoadVars object that called the load? such as this..


Code:
myLoadVars = new LoadVars();
myLoadVars.load("http://whatever.asp");
myLoadVars.onLoad = function() {
do whatever;
}

Is there anything wrong with this code?

View Replies !    View Related
Correct Syntax ?
Thanks for reading this!

I have an MC on the main timeline named "dance" and another named "dance_control". When "dance_control" is activated it *should* tell "dance" to jump five frames forward from its current keyframe.

Whats wrong with my control script?

_root.dance.gotoAndPlay("_currentframe++5");

Thanks!

View Replies !    View Related
Correct This Script
Ive got this script to make moving text

Code:
onClipEvent(load) {
_root.scrollBox = " this text is scrolling"; // put your text here, leave spaces at the beginning
}
onClipEvent(enterFrame) {
firstChar = _root.scrollBox.substr(0, 1);
_root.scrollBox += firstChar;
_root.scrollBox = _root.scrollBox.substr(1, _root.scrollBox.length);
}
I want to make the text move slowly... but how? the longer the text is, the faster it goes.

View Replies !    View Related
Correct Script?
Hi (Flash 5 question)
I'm trying to ask the timeline in my flash movie to go to a specific frame when you press a button which is inside a graphic which is inside a movie clip within the main movie.

Genevieve Paris was kind enough to direct me to using _root or _level0
to designate the main movie's timeline.

This is the script I've attached to the button:

on (press) {
_root.gotoAndPlay("space", "start");
}


"space" is the name of the scene I want to move to on the main timeline and "start" is the label I've attached to the 1st frame
of that scene.

When I test the movie and press the button, the mouse over is acknowledged but nothing else happens.
Can anyone point me right, and Genevieve if you're reading this,
sorry I couldn't just run with your excellent help!

Signed
Mr. Inovermyhead

View Replies !    View Related
Correct Syntax
I'm trying to make this code dynamic.

this.myImageVar = _level0.myMC.myArray3[x];

I want to make the name of the array dynamic so I can reuse the code for other arrays.

Like so:

this.myImageVar = _level0.myMC.myArray + myArrayNum + [x];

What would be the correct format for this?

Thanks in advance

View Replies !    View Related
Copyright © 2005-08 www.BigResource.com, All rights reserved