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




Search MovieClips In A Certain Movieclip



Hello.
I got a question

Is it possible to find all the movieclips in one certain movieclip?
I thought it would work like this (but it doesn't :s):


ActionScript Code:
for each (var Mc:MovieClip in this.CertainMovieClip){      //DO SOME STUFF HERE}



ActionScript.org Forums > ActionScript Forums Group > ActionScript 3.0
Posted on: 11-07-2008, 04:10 PM


View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread

[AS3] How To Access Child Movieclips [movieclip Within A Movieclip]?
I have made a simple fla that
- add movieClip1 on the stage
- moves the movieClip1 from right to left
- when movieClip1 detects a collision with the mouse, it stops.
- when mouse is not in-contact, it continues to move left to right.

The problem I am facing now is...
how do I access the movieClip1_child1_animation2

By default, when movieClip1 is added into the stage, it play
movieClip1 -> movieClip1_child1 -> movieClip1_child1_animation1

NOTE: movieClip1_child1 and movieClip_child2 are not dynamically added via class/actionscript, its already inside movieClip1. Same goes with animation1 and animation2 movieclip, both animations are already in the child1 and child2 class.

http://img100.imageshack.us/img100/5...vieclipzf5.png

Search And Replace Text With Movieclip
Any input will help...

Is it possible to search for specific text that is loaded from a database and into a dynamic textfield and then replace that specific text with a movieclip or an external JPG inside said textfield?

Something Like...

loadText = new loadVars();
loadText.load("http://www.SOMESITE.com/TEXTFROMDB.php);
loadText.onLoad = function(success) {
if (success) {
var myString = TEXTFROMDB;
myString = myString.split(":-)").join(MYMOVIECLIP.loadVariable"SMILEY.jpg", 0));
TEXFIELD += myString
}
}

Muchos Gracias,
Finhead

Movieclips In A Movieclip
I made a file the name is newfish.fla in FlashMX.
And I made a movieclip symbol for a fish image and the instance name is I_NewFish.
and it has 7 layers and the every layers are movieclips for the purpose that I want to make fishs who have different colors and sizes.
And the instance name of movieclips of the layers is I_Back_NewFish, I_Pattern_NewFish, I_EyeApple_NewFish, etc.

And I edited ActionScript in first timeline of first scene like this.
this.attachMovie("I_NewFish", "I_NewFish"+i, 10+i, {_x:x, _y:y,_width:width,_height:height});

And it has 7 err like this.
EyeApple_NewFish, layer=Layer 1, frame=1:Line 1: The class 'I_EyeApple_NewFish' could not be loaded.

How can I creat duplicated images that have different colors and sizes of the each layers?

Keep Movieclip On Top Of Other Movieclips
I have a flash movie setup so you can duplicate movieclips. Whenever the movie duplicates a movieclip it gives it a new instance name and puts it on top. I have a particular movieclip that I want to keep on top of everything else. Any idea how to do this?

Movieclips In A Movieclip
Hey Guys,

I'm struggeling with a problem. I want to create new movieclips when i start my Flash application and then controlling these movieclips all at once. For example they have to be scrollable.

My code is now like this, and I'm kinda stuck:


Code:
var depth:Number = 0;
var xOffset:Number = 30;
var yOffset:Number = 60;
var arr:Array = new Array();
var ww_arr:Array = new Array();

createTxt = function(){
for(var i=0; i<arr.length; i++){
mc = attachMovie("item", "item_"+i, depth++);
mc.item_txt.text = arr[i];
mc.item_txt.setTextFormat(txt_fmt);
mc._x = xOffset;
mc._y = yOffset;
mc.autoSize = true;
mc._visible = false;
yOffset = yOffset + mc._height;
}
yOffset = 60;
for(var i=0; i<ww_arr.length; i++){
mc = attachMovie("item", "sec_item_"+i, depth++);
mc.item_txt.text = ww_arr[i];
mc.item_txt.setTextFormat(txt_fmt);
mc._x = xOffset + 100;
mc._y = yOffset;
mc.autoSize = true;
mc._visible = false;
yOffset = yOffset + mc._height;
}
}
How can I controle these two columns at once? I tought of maybe putting them in the same movieclip. But how can I do that?

thnx

Movieclips In A Movieclip?
Hi! Everyone,

I have 3 movieclips (mc1,mc2,mc3) in a movieclip (mcMain)
when i use the code:

Code:
//attach the movie in stage
this.attachMovie("mcMain","mcMain",4);
how can I handle with mc1,mc2,mc3 in mcMain.

I try to use:
trace(this.mcMain.mc1._x);

but it says undefine!
help me please.
Thank you so much
Bestregard,

Traversing Movieclips In A Movieclip.
Hi there.

Is there any good way in actionscript of traversing through all movieclips in a movieclip. Short example in pseudocode:

for each mc in mainMC {
mc.move();
}

Any help is appreciated
Thanks
/ karl berseus

Keep Levels Below Movieclips? & This.movieclip?
Hi,

I've got 2 questions, probbly easy for most

Q1:

when you have actionscript inside of a movieclip, is there anyway to find the name of the clip thats running it? like this.movieclip, or me, or current or anything that could give somthing like the current clip is (_root.me1)

and:


Q2:

i've got this working fine:

duplicateMovieClip(_root.clip, "clip"+_root.x, _root.x);

where x just increases each time.

But i would like the duplicated clips to stay under the already made movieclips on the screen, so the already made ones are ontop of the new ones.

Thanks very much.

[CS3] MovieClips Inside A Movieclip
Flash is making me feel like a damn fool. Granted I've only been using it for a few weeks.
Alright, so I've got a bunch of movieclips inside of another movieclip. Inside the movieclip (called star_mc) I have another movieclip called mcStarburst, that I want to play when I roll over the clip. I have a frame with the stop(); command on the first line.
When I run the thing though, I just get a bunch of errors. I can't click on the thing and get a trace statement in my output, and the starburst animation just plays over and over again, completely disregarding my stop command.
And on top of that not even my buttonMode works right. What gives?

Here are the errors:
1119:Access of possibly undefined property mcStarburst through a reference with static type Function.
1061: Call to a possibly undefined method addEventListener through a reference with static type Class.
1061: Call to a possibly undefined method addEventListener through a reference with static type Class.
1119: Access of possibly undefined property buttonMode through a reference with static type Class.

And here is the code I'm using:
star_mc.addEventListener(MouseEvent.CLICK, onClick);
star_mc.addEventListener(MouseEvent.ROLL_OVER, playStarBurst);

function onClick(event:MouseEvent):void
{
trace("Ok this better work")
}

function playStarBurst(event:MouseEvent):void
{
play.mcStarburst;
}

star_mc.buttonMode = true;

MovieClips Inside MovieClip
Hi everyone,

Im trying to get the number of mcs that I have inside another one:


Code:
var mc1:MovieClip = new MovieClip();
var mc2:MovieClip = new MovieClip();
var mc3:MovieClip = new MovieClip();

mc1.addChild(mc2);
mc1.addChild(mc3);

for ( var i in mc1 ) {
trace( i ); //this used to work in AS2
}
my problem is that it even doesn't get inside the for loop for the trace... :P

is there any other way to get to the movieclips inside another movieclip?

THKX,

Dynamicly Name MovieClips Within A Movieclip
Stuck again

Code:
function displaySelectedArray(whichArray, layoutMC, elementName, elementWidth, elementHeight)
{
layoutMC = layoutMC._name;
elementName = elementName.toString();
for(i=0; i<whichArray.length;i++)
{
trace("Teast "+whichArray.length)
//dynamicly attach mc's to print_mc
element = whichArray[i];
_root.print_mc[layoutMC].attachMovie(element, elementName+i, i);
_root.print_mc[layoutMC][elementName+i]._y = (elementHeight + 1)*i;
_root.print_mc[layoutMC][elementName+i]._width = elementWidth;
_root.print_mc[layoutMC][elementName+i]._height = elementHeight;
//for testing this one attach movie
_root.print_mc.test_mc.attachMovie(element, elementName+i, i);
}

}
this may not be clear for you but I think it has to do witth

Code:
_root.print_mc[layoutMC].attachMovie(element, elementName+i, i);
which doesn't work

this seems to work

Code:
_root.print_mc.test_mc.attachMovie(element, elementName+i, i);
Everything worked when I didn't put it all in print_mc


Code:
function displaySelectedArray(whichArray, layoutMC, elementName, elementWidth, elementHeight)
{
layoutMC = layoutMC._name;
elementName = elementName.toString();
for(i=0; i<whichArray.length;i++)
{
//dynamicly attach mc's
element = whichArray[i];
_root[layoutMC].attachMovie(element, elementName+i, i);
_root[layoutMC][elementName+i]._y = (elementHeight + 1)*i;
_root[layoutMC][elementName+i]._width = elementWidth;
_root[layoutMC][elementName+i]._height = elementHeight;
}

}

Insert Movieclips Into Another Movieclip
How do you insert a movieclip into another movieclip?
I am following a tutorial at

http://www.emanueleferonato.com/2006/11/18/flash-game-creation-tutorial-part-2/

and i need to insert a movieclip called hero_hit into my other movieclip, hero

MovieClip's Over MovieClips Don't Disable?
I have two movieclips on my stage. For this problem, lets describe them as movie clip X, and movie clip Y. Movie clip X has a depth of 1 and movie clip Y has a depth of 2.

Movie clip Y is moveable and will sometimes overlap movieclip X (which works fine because of their depths). However, movie clip X has buttons that, although you cannot see them when Y is overtop of X, you can still click "through" Y to access X's buttons.

I don't want to totally disable movie clip X; if you can still see the buttons I want the user to be able to click them. If movie clip Y is overtop of those buttons you shouldn't be able to click through Y to access X's buttons.

I'm trying to build a simple window model in Flash. Help would be greatly appreciated.

MovieClip's Over MovieClips Don't Disable?
I have two movieclips on my stage. For this problem, lets describe them as movie clip X, and movie clip Y. Movie clip X has a depth of 1 and movie clip Y has a depth of 2.

Movie clip Y is moveable and will sometimes overlap movieclip X (which works fine because of their depths). However, movie clip X has buttons that, although you cannot see them when Y is overtop of X, you can still click "through" Y to access X's buttons.

I don't want to totally disable movie clip X; if you can still see the buttons I want the user to be able to click them. If movie clip Y is overtop of those buttons you shouldn't be able to click through Y to access X's buttons.

I'm trying to build a simple window model in Flash. Help would be greatly appreciated.

Number Of Child MovieClips In A MovieClip
Hey Fellas,

got a stumper here for the time being. I'm going to be hacking at it for a while so i figure i'd throw it out to the pack, see if any of yous been down the path before

i'm attempting to make a symbolic constant that represents the number of child movieClips within a certain parent clip such that

Movie Clip: Frame=1 Target="_level0.level1"
Shape:
Movie Clip: Frame=1 Target="_level0.level1.item1" Label="closed"
Shape:
Movie Clip: Frame=1 Target="_level0.level1.item2"
Shape:
Movie Clip: Frame=1 Target="_level0.level1.item3"
Shape:

so that the MC, level1, would return a number of 3

now, i figured that because flash treats things as arrays of objects, i could just use the method .length, however this is not the case...

any ideas, thoughts, comments, donations, tomatoes, monster trucks, etc... are welcome, if you need clarification, ask!

Thanks in advance
Gizmo

quick note: i know i can run a loop script that'll return me the answer, i'm just meandering for an easier 1-line solution

Dynamic Movieclips Nested Within A Movieclip
hello.

i'm trying to dynamically create duplicate movieclips within another movieclip. the movieclip is duplicating on screen, however the button events are ONLY set for the last instance, mc3 and not the rest (mc0, mc1, and mc2). also, all button instances are given the mc3 events. where am i going wrong?

you may paste this directly into a new project:
// create movieclip to duplicate
createEmptyMovieClip("mc", getNextHighestDepth());
with (mc) {
beginFill(0x999999);
lineStyle(3, 0xffffff);
moveTo(0, 0);
lineTo(100, 0);
lineTo(100, 100);
lineTo(0, 100);
endFill();
}

// make an array of duplicate movie clips
for (var i:Number = 0; i < 4; i++) {

// duplicate movie clip
var new_mc_name:String = "mc"+i;
mc.duplicateMovieClip(new_mc_name, getNextHighestDepth());
trace(new_mc_name);

// position movieclips elsewhere so that we can see them
this[new_mc_name]._x = Math.random() * 300;
this[new_mc_name]._y = Math.random() * 300;

// add onPress function
this[new_mc_name].onPress = function() {
startDrag(this[new_mc_name]);
trace (new_mc_name+".onPress");
};
this[new_mc_name].onRelease = function() {
stopDrag();
trace (new_mc_name+".onRelease");
};
}

thanks in advance!

Movieclip Ontop Of Loaded Movieclips?
Need Help!!!

i have a extermal movieclip loaded into level 1 but i need a movieclip object on the main timeline to stay ontop of the loaded .swf
Is this possible???????

ive tryed this:

onClipEvent (load) {
this.swapDepths(1000);
}

but this just makes it ontop of everything in the main timeline not the loaded ones....

Please Help

Duplicate A Movieclip Containing Duped Movieclips
I have a movieclip called 'image' in which I duplicate a 'holder' clip for however many thumbnails I have.

I now want to dup the 'image' movieclip so that I can scroll it seamlessly but it doesnt copy the duped clips inside?

Is there a way to create that clip and actually store it so that it can be copied properly?

Randomly Colouring Movieclips Within A Movieclip
Hi All,

I have a movieclip of an artists palette. Basically I was the colours (from a selection of colours stored in an array) to randomly appear in the 'wells' on the palette. Each well is an instance of a movieclip and they all share the same instance name. The code I have written basically should run through all the movieclip instances named pal2_mc within pals_mc and colour them from random colours chosen from the array. However nothing is happening and I have no errors so im pretty stumped being new to actionscript. Im sure it just a dodgy syntax thing but any help would be appreciated.

Heres the code:

var pal2Colors:Array = new Array(0x00ffff, 0x301900, 0x8affff, 0xffff00, 0x000000, 0x33ff00, 0x7f19ff, 0x7f19ff, 0x7a5c44, 0xffbfff, 0x459191, 0x0003fbf, 0x9ee182, 0xff7f00, 0x00f3a6, 0xd18aff, 0x007fff, 0xffde5e, 0x008700);

var pal2_mc:MovieClip;
for (pal2_mc in pals_mc)
{
//if (this [pal2_mc] instanceof MovieClip)
var my_color:Color = new Color(pal2_mc);
my_color.setRGB(pal2Colors[Math.floor(Math.random()*pal2Colors.length)]);
}

Thanks,

Justin

[F8] Extended MovieClip Class Containing Other MovieClips
Ok lets see if I can explain my predicament well enough for you.

I have created a movieclip in the library called DetailBox. Inside DetailBox is other objects, one that is a movieclip that contains an image (instance called mcImageBox) and the other is a dynamic textbox (instance called txtDetails). These objects are placed on the stage of the DetailBox movieclip.

I have created a class to extend the MovieClip class called DetailBox, saved in DetailBox.as. In the Linkage Properties for DetailBox I have ticked the Export for ActionScript and Export in first frame options. I have entered DetailBox in both the Identifier and AS 2.0 class fields.

In the DetailBox class I try to reference mcImageBox and txtDetails, but when I test the movie i geth the following messages in the Output window:

There is no property with the name 'mcImageBox'.

and

There is no property with the name 'txtDetails'.


The script in my DetailBox.as file is:


Code:
class DetailBox extends MovieClip {
public var _alpha:Number = 0;

public function init(xPos:Number, yPos:Number, itemName:String, itemDesc:String) {
mcImageBox._x = xPos;
mcImageBox._y = yPos;

// Sets the txtDetails Text Box to be able to resize and then fills it with text
this.txtDetails.wordWrap = true;
this.txtDetails.autoSize = true;
this.txtDetails.htmlText = "<p><b>" + itemName + "</b></p>";
this.txtDetails.htmlText += "<p>" + itemDesc + "</p>";

// Displays the DetailsBox*/
this._alpha = 100;
}
}


As you can see, I have tried to reference the objects with and without prefixing them with this..

If you can help me with this it would be very much appreciated.

Desired Movieclips Appear When Another Movieclip Is Dragged?
Hi guys, what I'm trying to achieve is this:

I have a draggable movieclip (instance name: donut) with the following code:
on (press) {
startDrag(this);
}

What I want is, when this draggable movieclip is pressed - it loads another movieclip (instance name: eyes) from the library in the stage. Is this possible?

Movieclip Hides Previous Movieclips
Hi!

I'm new to ActionScript and Flash.

I'm editing the GPL Flash Chart library "Open Flash Chart" (http://teethgrinder.co.uk/open-flash-chart/download.php) and I have a little problem.

I create an emptymovieclip with one image


Code:
_root.createEmptyMovieClip("bgImageObject", this.getNextHightestDepth() );
loadMovie(img, innerImageObject);
Later I create another emptymovieclip but I move and size it on the center of the flash scene.


Code:
function innerBackgroundColour( box:Box, colour:Number )
{
var myWidth = box.right - box.left;
var myHeight = box.bottom - box.top;
_root.createEmptyMovieClip("background", this.getNextHightestDepth() );

_root["background"]._x = box.left;
_root["background"]._y = box.top;

_root["background"].moveTo(0, 0);
_root["background"].beginFill(colour, 100);
_root["background"].lineTo(myWidth, 0);
_root["background"].lineTo(myWidth, myHeight);
_root["background"].lineTo(0, myHeight);
_root["background"].lineTo(0, 0);
_root["background"].endFill();
}
This movieclips hides the previous moviclip with the image. I tried with blendMode, opaqueBackground but nothing. When I use _alpha on the background movie I don't see nothing under. When I comment the call of this function I see perfectly the image on the background, so the problem it's in this function.

It should be a dumb property I should set elsewhere.

Thx.

Dynamical Stuffing A MovieClip With MovieClips
Ok, so the the problem is as follows:
the thing i need is to dynamicaly stuff some empty movieclip with some additional static movie clips. Let's pet'em samples. I have some set of samples. In the result I wanna get single movie clip, which will contain a certain number of samples. I wanna get the single movie clip, because my task is to drag it.
How can I perform it with the help if ActionScript 2.0

Maybe there is some other solution to drag a certain numbered group of samples not havin' put'em into a single movieclip.

Any help appriciated

MovieClip Containing Other Animated Movieclips -- Cache?
If I have a movieclip containing other animated movieclips, does cacheAsBitmap do anything for me? Will it make it worse?

What's the best practice for cacheAsBitmap in this case: Should I set it to be true for only the containing movieclip or also all the individual animated movieclips as well?

I know cacheAsBitmap hurts you if you rotate or resize your clips, but in this case I'll only be moving them (x and y) and animating them (gotoAndStop, play, etc)

Thanks!

Call A MovieClips Timeline While In Another MovieClip
Ok this is going to be hard to explain but i will try my best.

I have a button inside a MovieClip with an instance name of "playBTN". When you click a Button inside Continue named "pHit" I want the function to gotoAndStop(2) inside a movieclip on the main timeline named "selectContainer"

I have tried everything so far like "parent.selectContainer.gotoAndStop(2)" and "root.selectContainer.gotoAndStop(2)" but i keep getting the Variable undefined error. Any help on how to the scope works?

Code: First code is inside MovieClip "playBTN"


Code:
pHit.buttonMode = true;
pHit.addEventListener(MouseEvent.CLICK, select); //pHit is the MovieClip inside MovieClip "playBTN"

function select (e) {
_parent.selectContainer.gotoAndStop(2);
}
This Code is inside movieClip "selectContainer"

Code:
trace("It Worked");

Flatten Movieclips With Parent Movieclip
Hi there

I am building this drawing app where i use a movieclips (stored in my library) to act as my brush. the only thing i'm worried about is that with the increasing number of movieclips being printed onto the 'canvas' the performance is going down. so i was thinking of periodically 'flattening' the printed movieclips with its parent movieclip to reduce the number of movieclips sitting around. very much like the flattening of layers in Photoshop.

does anyone think that the large number of movieclips (only contain a circle with radial filling) would lower performance of the application, and that the 'flattening' would help?

any advice is highly appreciated
Thanks in advance
J

Get MovieClips Nested Inside Another MovieClip.
Hi.

I have a MovieClip named mcContainer. This MovieClip contains several MovieClips, mc01, mc02,..., mcN. I'm pretty sure there must be a way to automatically build an array containing the names of those MovieClips, I'm just missing how. Can anyone give me a hand?

Thank you in advance.

How To Get A List Of All The Child Movieclips Of A Movieclip
Hi!

I was wondering how I could get a list of all the movieclips inside a given movieclip.

For example, suppose I have two instances of a ball movieclip: ball1 and ball2. These movieclips are inside another one named balls.

Is there any method you could call on the movieclip balls that returns a reference to an array or object that with all the movieclips inside it (in this case ball1 and ball2).

I know I can use balls['ball1'] to reference one of the movieclips, but balls.length or balls[0] does not work.

Attaching Movieclips From Library Into A Movieclip
I have a MC shape, its actually a parallelogram and so its slanted and the perspective is tilted a bit (not sure if this matters).

I also have a few different MCs in the library the same shape which I want to place into the MC shape when different buttons are pressed.

For button one, I used this code:

on (release) {
myShape.attachMovie("firstMC");
}

Am I doing something wrong or using the wrong code? In the library, I named the first MC "firstMC" as you can see. I also put the linkage as "export as actionscript".

Any clues?

Multiple Movieclips Inside One Movieclip
Hi,

This should be simple but I can't figure it out... I have a master movieclip and I would like to create further movieclips within this one and load images in these. Here is how I did this:

var ThumbHolder:MovieClip = this.createEmptyMovieClip(mcThumbHolder,this.getNe xtHighestDepth());

var Thumb1:MovieClip = ThumbHolder.createEmptyMovieClip(mcThumb1,mcThumbH older.getNextHighestDepth());

var Thumb2:MovieClip = ThumbHolder.createEmptyMovieClip(mcThumb2,mcThumbH older.getNextHighestDepth());

Thumb1._x = 0;
Thumb1._y = 0;
Thumb2._x = 250;
Thumb2._y = 250;

loadMovie("images/thumb_1.jpg",Thumb1);
loadMovie("images/thumb_2.jpg",Thumb2);

The movieclips are created but Thumb1 is not visible, it's hidden under Thumb2! What am I doing wrong?

Any help is much appreciated!

Updating MovieClip Position According Other MovieClips
Hi,
I have some Headline MovieClips that are been attached on the stage on runtime based on an xml file.

Each Headline is placed one after the other vertically on the stage, and each one of them, when clicked, expands showing the description of the headline, pushing the other headline MovieClips down, according to how much _y is the description occupying.

I did a smilar example with some boxes attached on the stage with a loop, one after the other. Each Box, on RollOver, increases by _yscale to 130% for example and pushes the other Boxes down as:

i
Code:
mport caurina.transitions.Tweener; //using Tweener to tween the _yscale property
num =4;
var boxes:Array = new Array();

for (i=0; i<num;i++) {
var Box:MovieClip = _root.attachMovie("Box","_Box"+ i, _root.getNextHighestDepth());
// box height and width is 150
Box._x = 0;
Box._y = 160 * i;
boxes[i] = Box;


Box.onRollOver = function () {
Tweener.addTween(this,{_yscale:130, time:.5, onUpdate:updatePos});
}
Box.onRollOut = function () {
Tweener.addTween(this,{_yscale:100, time:.5, onUpdate:updatePos});
}
}

updatePos = function () {
for(var i in boxes) {
boxes[i]._y = boxes[i-1]._y + boxes[i-1]._height + 10;
}
}
This works good, but in executing the updatePos function, flash shows a slight delay between all the boxes that are shifting down due to the loop (the boxes shift one by one).

Is what I am using here right? Is there any other Method i can use to achieve this? I've seen this in other sites working better.

Any Ideas?


Regards...

Clicking On Movieclips Inside Another Movieclip
Hi there,

I'm having a whole lot of trouble with some nested movie clips. Here's the situation.

I'm duplicating movieclips inside a container movieclip. That works fine. My problem is, the onPress event that I assign to them doesn't fire. It appears that the container movieclip is "blocking" it's children movieclips.

I've been trying all the Propagation work-arounds but nothing seems to work.

The Goal: I want to click on one of the "parts" in th left side menu and i want it to trace one of it's properties. At this point, if it traced "Hi" i'd be happy. I just want it to fire when i click on it.

I'm not able to upload the files so you can find them here:
http://www.cybertekresearch.com/sharing/share.html

the files are called Parts.as and parts.fla
I'm pretty sure the pertinent code is between line 81 and 99 of the .AS file.


Thanks

Loading Movieclips To Empty Movieclip...?
I guess this is a common question, but I´m looking for a tutorial and I cant find one...maybe I´m not looking for the correct words.
I want to do a simple thing - instead of having lots of pages, I want make everything in the same fla, loading movieclips to the stage, to a empty movie clip (I guees thats the way). Don´t need to be external movies (swfs). Look for example http://www.iso50.com/iso50.html ... this is made this way right? Loading the movieclips to the right side of the stage...Am I wrong?
If anyone can explain to me, or if someone knows a good turorial, please share...that would be a great help

Thanx for any help

Hugs

This forum rules

Multiple Movieclips Inside One Movieclip
Hi,

I have the following problem... I would like to create an empty movieclip that will be placed on the form then create a second mvieclip within this first one and then again create multiple movieclips within this second clip. The second clip should work like a carrier for the smaller movieclips (for tweening, etc). Here is how I did it:

var MainHolder:MovieClip = this.createEmptyMovieClip(mcMainHolder,this.getNextHighestDepth());
var ThumbHolder:MovieClip = MainHolder.createEmptyMovieClip(mcThumbHolder, MainHolder.getNextHighestDepth());
var Thumb1:MovieClip = ThumbHolder.createEmptyMovieClip(mcThumb1, ThumbHolder.getNextHighestDepth());
var Thumb2:MovieClip = ThumbHolder.createEmptyMovieClip(mcThumb2, ThumbHolder.getNextHighestDepth());

MainHolder._x = 100;
ThumbHolder._x = 100;
ThumbHolder._y = 100;

Thumb1._x = 0;
Thumb1._y = 0;
Thumb2._x = 250;
Thumb2._y = 250;

Thumb1.loadMovie("images/thumb_1.jpg");
Thumb2.loadMovie("images/thumb_2.jpg");

The images show up OK only that... thumb_2 is covering thumb_1 so this is invisible and I can't move them at all (using the _x property) What am I doing wrong!?

Many thanks in advance!

Count Elements (vars,movieclips) In Movieclip
Is there a way to count the child-elements (variables,movieclips) of a movieclip?
movieClip.elements.length doesn't work.
I know there is a way, but i forgot...

What i want to do?
I want to realize a xml-based-mailform that sends all textfields included in a movieclip automatically to a serverscript.
It should be possible to enhance/change the number/names of textfields without changing the as-code, just by adding a textfield.
This brings me a maximum of flexibility for future flashsides.

How To Set Visibility/invisibility Movieclips Or How To Hide (a) Movieclip(s)
hallo everyone... i'm a bit new in flash...

my problem is ...
i've a scene, i put there 4 movie clips, which representing the links (i use telltarget)... i don'T know how to hide the movie, after it loads... or when user click on another links, that produce another movieclip...
get it ? i also dunno how to tell it...
when i click one of it.. a movieclip showed up, and when next i click another one, the first won't dissapeared, so its stacked up.. and it goes again and again... when i click all of it, all of it stacked up.... could anyone help me and tell me how to solve it? i think it'S just problem with the actionscript, which i don't have any idea about it...

need repliess !!!

Loading MovieClips From A MovieClip Into The MainTime Line
Flash 8
AS2.0

Hi,

I'm back again, after 5 months of flash i've started to get some where which is great! However, i've hit a problem and i'm seeking a bit of advice.

I'll try and explain as best as i can.

I have a movie clip on the main time line (stage) which loads around frame 80 which is the welcome screen (movie)

When a button is selecting it calls a function called "ScreenChanger_mc" and loads it into a empty movie clip using the x and y properties set. In this case the Services button is selected which sets a global variable to 1

When the ScreenChanger_mc runs and reaches the end of that movie theres an if statement which states if (_global.selected == 1) then load services_mc into the main time line.

My problem is the services_mc doesn't load into the main time line, i've traced the if (_global.selected == 1) and it returns.

Is my problem caused by the ScreenChanger_mc runs to the end and flash is trying to load the services_mc into ScreenChanger_mc instead of the main time line?

Any advice would be great.

Thanks for reading.

Garry

Copy Pixels From A MovieClip Containing Other Dynamic MovieClips
Hi folks.

I'm trying to copy the pixels of a MovieClip that's created as an empty movie clip, and has other MovieClips added to it via ActionScript (little blocks which make up an alphabetic character. I know how to copy pixels from a MovieClip that's already got content when in the library (with the BitmapData.draw method), and I've tested this with my current code: instead of starting off with a blank movie clip, I drew a square at the top left of a MovieClip, and put it in the library. Then, I drew my character onto an instance of that MovieClip, and then copied the pixels from it. What I got was a white rectangle, as usual, but with the blue block at the correct place - the top left.

So, what I'm asking is, does anyone know how I can copy pixels from a MovieClip that doesn't just have Transform, but also has these child MovieClips, which also have transform and contain child MovieClips, which also have transform?

[Q] How To Duplicate A Series Of MovieClips Under Another MovieClip / Print?
Howdy...

I think I am missing something but I do not know what it is...

Basically, I want to do the print, so I am about to prepare the new movieClip, printMe_mc, and in the process of transferring all the movieClips under the printMe_mc, and that's where I am having problem with...

I have a movieClip on the stage, city_mc, and in there, I have 10 individual movieClips...

_level0.city_mc.city0_mc
_level0.city_mc.city1_mc
_level0.city_mc.city2_mc
...
_level0.city_mc.city9_mc

Now, I want to move all those movieClips under the printMe_mc, so that it will be something like this...

_level0.printMe_mc.city_mc.city0_mc
_level0.printMe_mc.city_mc.city1_mc
_level0.printMe_mc.city_mc.city2_mc
...
_level0.printMe_mc.city_mc.city9_mc

or

_level0.printMe_mc.city0_mc
_level0.printMe_mc.city1_mc
_level0.printMe_mc.city2_mc
...
_level0.printMe_mc.city9_mc

with this script, but somehow duplication is not made... What am I doing wrong and how do I fix this???
PHP Code:



theDepth = 1000;
this.createEmptyMovieClip("city_mc", theDepth++);
for (var i = 0 ; i < 10 ; i++)
{
    this.city_mc.attachMovie("MC_City", "city" + i + "_mc", theDepth++, {_x:i * 10, _y:i10});
}

this.createEmptyMovieClip("printMe_mc", theDepth++);
this.printMe_mc._x = 100;
this.printMe_mc._y = 100;
for (var i = 0 ; i < 10 ; i++)
{
    this.city_mc.attachMovie("MC_City", "city" + i + "_mc", theDepth++, {_x:i * 10, _y:i10});
    this.city_mc["city" + i + "_mc"].duplicateMovieClip(this.printMe_mc["city" + i + "_mc"], theDepth++);





Thank you...

Detecting Or Iterating Through All Movieclips Within A On-stage Movieclip
How to do this for on-stage MovieClips in authourng view (when they appear in the timeline).

I tried hacking the


Code:
MovieClip.prototype=function() {
trace("detect existence of:"+this);
}
or
MovieClip.prototype.onLoad=function() {
trace("detect existence of:"+this);
}
But it doesn't work and onLoad only works if you load something through .swf. onUnload event does work though for the individual sub-mcs.

The only way I've seen is to do this.


Code:
MovieClip.prototype.onEnterFrame=function() {
trace("detect existence of:"+this);
this.onEnterFrame=null; // deleting this.onEnterFrame doesn't even work!!!
}
So, what should i do? In Actionscript 3.0, i can simply iterate through the DisplayList. In As2.0, the depths of the on-stage authoring movieclips will not have any particular function to execute upon construction. So, how do i deetect them?

Drag Movieclips Into A Scrolling Target Movieclip
hi,

i've built a file in as2/flash cs3 that dynamically loads 40 thumbnail images. what i want to do is allow users to drag the thumbs into a horizontally scrolling window - and once they release the thumb a larger version of the image is seen (ideally, i want to allow users to move the images again if they need/want to).

i also want to present an already loaded composition (chosen by me) that shows them the intent, then allow them to clear the stage so that they can load in their own choices.

any ideas on how i should do all this? i've already started the process, as i said, but i'm willing to re-code in as3 if it would help. of course that means i have to figure out how to load the xml in as3 as well. *sigh*

thank you!

Problem With Attaching Movieclips In A Loaded Movieclip
Hello everyone I really hope someone can figure this out. I just cant get it to work and I'm starting to think it can't be done

I am loading in a movieclip via the loadMovie funtion. This movieclip has alot of movieclips with linkage in its library.

Since i from the beginning had trouble making the loaded movie attach the chosen movieclip I simply put this code in its main timeline


PHP Code:



this.attachMovie(_root.kast, "goalie", this.getNextHighestDepth()); 




kast is a variable defined in the main movie and this worked allright except that I just realized I really need to be able to stop/start/and remove the attached movie with actionscript from the main movie without having to load the movie again.

I'm trying to speak to and attach movieclips from the loaded movie like this

PHP Code:



this.createEmptyMovieClip("holder",this.getNextHighestDepth());holder.loadMovie("myMovie.swf");holder.attachMovie("myMovieClip", "myMovieClip", this.getNextHighestDepth()); 




doesn't work even tho myMovie.swf does got loaded and placed inside holder

Please help or point me in the right direction

Perform Action To All Movieclips Inside A Movieclip
Hello all, I have a movieclip with about 50 other movieclips inside it and I want to set all their visibility to false (I can't do this to the parent because I will need to eventually just show one of the movieclips at a time). Is there any type of method I can use to apply, something like mymc.allchildmcs.visibility = false or mymc.mychildmc[i].visibility = false;

Create One MovieClip From An Array Of Dynamically Attached MovieClips?
Hello,

I have been searching for the answer to this, but have been unsuccessful thus far. Any help will be appreciated, as I am a Newbie at ActionScript.
I am currently working on a scrolling thumbnail panel, which contains dynamically-loaded images. The images are moved automatically based on the position of the mouse. The code with asterisks is where I am having trouble. Below is the code I am using:

ActionScript Code:
//number of pics being used
var numOfItems:Number;

//center of pics coordinates, set to exact center of stage
var centerX:Number = Stage.width/2;
var centerY:Number = Stage.height/2;

//speed of pics
var speed:Number = 0.5;

//create variable for for loop
var home:MovieClip = this;

//create new xml object
var xml:XML = new XML();
xml.ignoreWhite = true;

xml.onLoad = function() {
    //find all child nodes from xml file, and assign them to an array
    var nodes = this.firstChild.childNodes;
    numOfItems= nodes.length;
   
    //attach icons to stage
    for(var i=0;i<numOfItems;i++){
        var t = home.attachMovie("item", "item"+i, 10000+(i+1));
       
        //distance between pics
        t.distance = i * (100);

                          //start the function that moves pics
        t.onEnterFrame = mover;
   
        //load in the pics file
        t.icon.inner.loadMovie(nodes[i].attributes.url);
        t.r.inner.loadMovie(nodes[i].attributes.url);
       
        //trying to make all pics into one MovieClip**********
        var allPics = Array("item"+i);
        trace(allPics); //returns: item0,item1,item2...
                          var allPics2 = MovieClip("item"+i);
                          trace(allPics2); //returns: null
    }
}

//use this code to set the mask on the pics movieclip
allPics2.setMask("mask");

//load in the xml file
xml.load("pics.xml");

I think that I need to make one instance name(and one MovieClip) out of all the pics together. Then, I will be able to mask them properly. I also need to have one name for them all, so that I can stop the entire panel of pics from going right off the stage, when the scrolling reaches the end of the panel. I know how to do that, but I can't until I get all of the pics under one MC name. I hope that I was able to explain this well. Thank you so much for your time and help!

Accessing MovieClip Textfields Through Extended MovieClips Classes
I am having difficulty locating textfield in MovieClips in extended classes that I link the movies to. I need to be able to access from the MovieClips:

1. The native variables of the MovieClip class.
2. The Text fields created for the MovieClip.

My experience so far is that my Classes created as extentions of the MovieClip class do not have visiblity to the text Field I created inside the MovieClip from the Flash GUI interface. It might be my misunderstanding of what is required to enable this visiablity, but I tried to view the text field instance by its instance name.
The code:
class Menu extends MovieClip{
var gameScore:Number;
_x = 150;

public function Menu(){
gameScore = 0;
score.text = gameScore;
...

The error I recieved for this is:

"**Error** C:Menu.as: Line 12: There is no property with the name 'score'.
score.text = gameScore;

where "score" is the instance name of the textfield that I created for the menu movieClip which is linked to the menu.class

Accessing Child MovieClips Added On 2nd Frame Of A MovieClip
I am trying to build a simple dropdown menu but am running into some issues attaching event listeners to the nested movieclips for the submenu items. Here is what I have done:

Created a movieclip that on frame 1 only shows a one-row title, such as "FILE". On the second frame I added additional MovieClips below the FILE named "SAVE" and "EXIT". I gave these 2nd frame children an instance name of subFileSave and subFileExit. I placed the completed MovieClip FILE on the stage and gave it an instance name of menuFile. The individual movieclips are exported for actionscript with 1st frame option.

Now in the main actionscript associated with the fla, I have the following code to control the submenu dropdown. (typing from memory since I am not at home with the code):

menuFile.addEventListener(MouseEvent.MOUSE_OVER, menuMouseOver);

public function menuMouseOver(e:MouseEvent):void
{
menuFile.gotoAndStop(2);

menuFile.subFileSave.addEventListener(MouseEvent.CLICK, gotoFileSave);
menuFile.subFileExit.addEventListener(MouseEvent.CLICK, gotoFileExit);
}

I am getting an runtime error when attaching the event handlers for the submenus. At what time are the menuFile.subFileSave variables properly set so that I can setup the event handlers? Could someone explain to me how nested movieclips are handled if added after the 1st frame of a movieclip? Any help much appreciated, I dug through many forums and the adobe help texts to figure this out.

I am wondering if I have to wait after calling the gotoAndStop function before the properties for the submenu items are properly set, but cannot figure out how.





























Edited: 04/21/2008 at 06:21:35 AM by rsentgerath

Pushing Movieclips Created By Create/duplicateMovieClip Into 1 Movieclip?
Okay using createMovieClip I've created an MC called container0. Now, using duplicate movieclip & some for loops, the movie created up to 20 containers which go by the name of:

container1
container2
..
container20

Now is there any way (possibly using a for loop) to push all containers from 0 to 20 into 1 master movieclip?

OR

Is it even possible during the duplicateMovieClip/createMovieClip function that I can arrange which movieclip the new duplicated/created movieclip goes into?

--

So you know the story, I'm trying to create a ton of boxes, that I eventually want to use the image pan script on.

[AS 2.0] EXPERT Assoc. Array Help: Accessing MovieClip Vs. Non-MovieClips
I'm currently working through a tutorial that builds an interval manager class. This interval manager class is specifies custom setInterval and clearInterval functions that enable the normal _global.setInterval and _global.clearInterval methods to call a function located in any object, and also to call that fucnction in any scope. It uses an associative array to store references to the objects in which the custom setInterval is called so that they can be cleared at later time.

Question: When adding items to this associative array, the custom setInterval function specifies two ways for creating references for its associative array. One way is is used to create references for MovieClips, and the other way is for non-MovieClips. Why is this necessary? The tutorial states that you must first create an ID for the non-Movie Clip references, but I don't understand why this extra step is necessary.

Here is the class file code:


Code:
class com.oop.managers.IntervalManager {

static private var __listeners:Object = {};
static private var __intervalID:Number = 0;

function IntervalManager() {};

static public function setInterval(connection:Object, intName:String, path:Object, func:String, time:Number):Void {
clearInterval(connection, intName);
if (connection instanceof MovieClip) {
if(__listeners[connection] == undefined) {
__listeners[connection] = {};
}
__listeners[connection][intName] = _global.setInterval(path, func, time, arguments[5], arguments[6], arguments[7], arguments[8], arguments[9], arguments[10]);
} else {
if(connection.intervalID == undefined) {
connection.intervalID ="int" + (__intervalID++);
}
__listeners[connection.intervalID] = {};
__listeners[connection.intervalID][intName] = _global.setInterval(path, func, time, arguments[5], arguments[6], arguments[7], arguments[8], arguments[9], arguments[10]);
}
}
static public function clearInterval(connection:Object, intName:String):Void {
if(connection instanceof MovieClip) {
_global.clearInterval(__listeners[connection][intName]);
} else {
_global.clearInterval(__listeners[connection.intervalID][intName]);
}
}
}

Select A Random Movieclip Form An Array Of Movieclips
Hi, iv been trying to find out how i can attach a random movieclip form an array of movieclips.

Iv got this so far, i have searched the forum etc for help and i am pretty stuck.


PHP Code:



var logo_arr:Array = new Array("logo01", "logo02", "logo03", "logo04", "logo05", "logo06", "logo07", "logo08", "logo09", "logo010", "logo011"); var randomLogo:Number = logo_arr[Math.floor(Math.random()*11)]; var dynamiclogo_mc = this.attachMovie("randomLogo", "randomLogo", 3); dynamiclogo_mc._x = Stage.width/2 - 180 ;dynamiclogo_mc._y = Stage.height/2 - 420; 




All my movieclips are in the library and have the linkage for actionscipt enabled.

I cant see what it is im missing?

Any help is much apreciated

Thanks, Sam

Copyright © 2005-08 www.BigResource.com, All rights reserved