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




Action Script In Child Movie Clips, Instances, Symbols( Problem)



Hi,
Have come across a problem when trying to use action script in a movie clip symbol (created in the Library) and using an instance in a layer in the main move.

The action script which is in the movie clip instance seems to work differently to how it would if the exact same code was in a script layer in the main time line (or u could say that is doesn't work the the way it should).

I have 2 examples of this:

- XML.load(); loads but does not parse (ie load xml into DOM), yet returns success = true in the onLoad call back.


- scope of Array objects seems to be limited. That is an array (in this case containing the XML) is not accessible from the next frame. or rather does not exist in the next frame. Trying to assign this array to a globaly declared array results in a zero length array.


has anybody come across this before? if so is this a known problem or am i doing something wrong?

thanks



FlashKit > Flash Help > Flash ActionScript
Posted on: 09-25-2001, 01:28 PM


View Complete Forum Thread with Replies

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

Help Applying An Action To A Bunch Of Child Movie Clips
Hi folks,

I'm trying to build a dealer locator map. I figured it would take me a day to figure out, and I've been struggling with it for a week. I've got almost all of it done, but there's one thing I still can't get a handle on.

I've got an accordion component containing the list of dealers called "myAccordion". I'm loading an xml file in it like so:

var my_xml:XML = new XML();
my_xml.ignoreWhite = true;
my_xml.onLoad = function(success:Boolean) {
myLabel.text = this.firstChild.childNodes[0];
myTextArea.text = this.firstChild.childNodes[1];
myTextArea2.text = this.firstChild.childNodes[2];
myTextArea3.text = this.firstChild.childNodes[3];
myTextArea4.text = this.firstChild.childNodes[4];
};
my_xml.load("ny.xml");

Then I have a movieclip called "map". In it are 50 child movie clips (one for each state) which are named "NY" (for new york), "WA" (for washington), etc.

When someone clicks on a state, I need 2 things to happen:

1. change the color of the state
3. load an xml doc with the same name (wa.xml, ny.xml, etc.) into myAccordion

How do I apply an action to all of the children of the map that will do that?

Symbols And Instances - Interactivity W/Movie Buttons
Hello,

I've been creating small scale animations for entry pages for years using mostly Freehand.

But now I've just started to design my first flash site. I designed the mockup in Freehand and at first everything was coming out right, meaning every animation I'd envisioned seemed easy to implement.

However I'm at the stage where I'm trying to have some interactivity with my portfolio. It's relatively simple really (comparted to some of the flash stuff I've seen).

I want people to click on the square which is mini image of the project, cropped. It rotates and then a full description of the project appears below.

I need some way to control how this happens. A close button on the detailed image or something. Right now I'm having trouble with the symbol. I assigned an action to the mini image and that action has been applied to the large image. I've tried renaming them but it seems all my editing goes directly to the symbol. Remember this is my first movie and I can't seem to think of or find out what I'm doing wrong.

Okay, attached is the section in question. The portfolio. Please take a look at the .fla and see if you can tell me all I'm doing wrong.

This is much appreciated.


Thanks!

Controlling Multiple Instances Of A Child Movie Clip
Hello,

I have a parent movie clip (instance name is Dandelion) that contains hundreds of instances (unnamed) of a child movie clip called Seedling. (so seedlings floating away from a dandelion at different points within the parent movie clip)

On the main timeline I have a 'stop' and 'play' button that control the main timeline and parent movie clip just fine. But the buttons have no effect on the child movie clips which just continue to play independently.

It would be too much work to go back and name every instance of the child movie clip and then code it into the button

_root.Dandelion.seedling1.stop();......

There must be a quicker and more efficient way! Is there a way to go into the child movie clip and code it to respond to the stop and play buttons in the main timeline? Or to have it stop when the parent movie clip stops?

Controlling Instances In Movie Clips From Other Clips
I am trying to get a button on my level 2 in my main movie to point to a frame inside a movie that has been loaded in on level 3 on the main movie. I have tried all different kinds of combinations and no success. I even tried putting the level 3 movie in an empty movie clip on the root, and naming the instance "music", and then writing in the button _root.music.GotoAndPlay(3); I need it to target frame 3 in my level 3 movie. Should I put the level 3 movie in its own empty movie clip? I was able to get the button to unload movie3, but I don't want it to dissapear, I just want it to go to frame 3 in the movie clip to turn off the music.. You can see what I mean at the address below. I have my audio player in the bottom right with an on/off that works fine, but when I go to the link in my site "Music" there are some downloadble MP3's, and when you click on one I want the "equalizer bars" you see in the audio in the lower right corner to stop, and it means I need it to go to frame "3" of tha movie clip for that to happen, just like it does when you click on "off" in the audio movie. Anyway, sorry this is long winded, but wanted to make sure it was clear as to what I am trying to do..

Thanks in advance,... Here is the link

http://www.incogneato.tv/stales


Mike

Child Movie Clips
Ok...I have a couple buttons that I want to load movie clips say box1.mc and box2.mc. How would I have "button 1" load box1.mc and when you click on "button 2" it would load box2.mc and have box 1.mc fade out and visa versa? I'm a newbie when it comes to this stuff, so details would be nice Thanks in advanced.

Movie Clips Vs. Symbols
Quick fundamental question...


I'm very familiar to going inside a movie clip and creating animations that either loop continuously, or that play once and stop using a Stop Action.

When would I go into a Symbol and take advantage of it's timeline rather than saving it as a mc instead ?

Any advice or examples you wish to share?

Cheers
Jenny

How Can I Remove All Child Movie Clips?
Hi guys.. I tried to search but the search doesnt seem to be working for me at the moment so guess i gotta make another pointless thread.

What I want to do is remove all child movies of a chosen movie. How can I do this?

thanks
-Geoff

edit: btw, i'm using Flash MX. (not 2004)

Iterating Through Child Movie Clips In AS3
I am working on migrating a very large Flash project from AS2 over to AS3, however I've hit a snag.

One of the effects within the project is an animated 3D 'ribbon' effect. It draws animated ribbons which fly around in 3D space and eventually land in a predefined stationary position (where multiple ribbons come together to form a line art drawing). In order to define the points for this final resting position, the effect requires small movieclip guides to be positioned at key points on the line (these guides are hidden at runtime, of course). In addition to providing an x,y coordinate for the ribbon to pass through, the scale of these clips represents the Z coordinate for the ribbon at that point, and the rotation helps determine the bezier control points which fall between the guide MCs.

Each drawing (collection of ribbons that form a single picture) contains dozens of ribbons and hundreds of guides. This method of using movieclips as guides is essential, as it is the only way to allow a designer to visually see where the ribbons will ultimately be drawn. Entering the x, y, z and rotation information manually per guide is simply not feasible.

To differentiate between the different guides, the MCs names were standardized to include the ribbon name and guide sequence. A simple example of this might be a smiley face. The ribbon that would draw the mouth might have 4 points. They would have to be named StartRibbonMouth, MouthGuide1, MouthGuide2, and EndRibbonMouth. That would create a ribbon named 'Mouth' with a start point, 2 points in the middle, and an end point. That, along with the previously mentioned rotation and scale data would be enough information to determine the final position of the ribbon (the animated paths are randomly generated at runtime).

The problem I am having is finding the guide clips by partial name in AS3. Since each ribbon has its own name, and each guide has a unique sequence number, I need to find the clips based on a partial name search (specifically the name's prefix). For example, first I scan for all guides that start with "StartRibbon" to get a list of ribbons contained in the parent movieclip. Then I use that list to find intermediary points (guides that start with the name of the ribbon) and then I find the end point (by the full name "EndRibbon" + the ribbon name).

In AS2 I had a function to return a reference to a clip based on the name prefix. It was essentially as follows:


Code:
for (var Item in Parent) {
if (typeof (Parent[Item]) == "movieclip") {
if (Parent[Item].name.substring(0, Prefix.length) == Prefix) {
return(Item);
}
}
}
Where Parent was a reference to the MC which contained the group of guide MCs to define all of the ribbons for a particular drawing.

In AS3 it is skipping the for loop completely. So far all I can find is a way to get the child MCs by full name, but no way to iterate through all of the child MCs and check each name against a substring.

Any ideas?

Parent/child Movie Clips
ok so i have a problem, i am relatively new to actionscript, my situation is:
1) i have all my actions in its own layer on the main timeline, so all is well there
2) i have a movie clip with a rollOver and rollOut events attached to it
3) inside the movie clip when the rollover happens and the movieclip stops at a certain frame, i have another movieclip that appears. the movie clip is a link to a website, it works properly on the main timeline but without the proper actionscript it of course will not work inside its parent movie clip

how do i fix this?

Deleting Child Movie Clips In Parent Movie Clip
ok so I when I click the bt1 I want it to make the home_text visible and remove all of the movie clips within the CreateXMLGallery function. But when I do gallery.removeMovieClip() it only deletes the gallery and none of the other movie clips that are created within the gallery. Any ideas why? here is the code.


HTML Code:
stop();
/***********Button Functions*************/
launch_mc._visible = false;
easeSpeed = 5;
slider_mc.onEnterFrame = function() {
this._x += (xMove1-this._x)/easeSpeed;
};
bt1.onRollOver = function() {
bt1.blendMode = "invert";
};
bt1.onRollOut = function() {
bt1.blendMode = "normal";
};
bt1.onPress = function() {
xMove = bt1._x;
};
bt1.onRelease = function() {
gallery.removeMovieClip();
home_txt._visible = true;
};
bt2.onRollOver = function() {
bt2.blendMode = "invert";
};
bt2.onRollOut = function() {
bt2.blendMode = "normal";
};
bt2.onPress = function() {
xMove = bt2._x;
};
bt2.onRelease = function() {
gallery.removeMovieClip();
home_txt._visible = false;
createXMLGallery(webXML);
};
bt3.onRollOver = function() {
bt3.blendMode = "invert";
};
bt3.onRollOut = function() {
bt3.blendMode = "normal";
};
bt3.onPress = function() {
xMove = bt3._x;
};
bt3.onRelease = function() {
gallery.removeMovieClip();
home_txt._visible = false;
createXMLGallery(interactiveXML);
};
bt4.onRollOver = function() {
bt4.blendMode = "invert";
};
bt4.onRollOut = function() {
bt4.blendMode = "normal";
};
bt4.onPress = function() {
xMove = bt4._x;
};
bt4.onRelease = function() {
gallery.removeMovieClip();
home_txt._visible = false;
createXMLGallery(avXML);
};
bt5.onRollOver = function() {
bt5.blendMode = "invert";
};
bt5.onRollOut = function() {
bt5.blendMode = "normal";
};
bt5.onPress = function() {
xMove = bt5._x;
};
bt5.onRelease = function() {
gallery.removeMovieClip();
home_txt._visible = false;
createXMLGallery(designXML);
};
/**********End Button Functions**********/
/**********Load XML files**********/
var webXML:XML = new XML();
webXML.ignoreWhite = true;
webXML.onLoad = function(success) {
if (success) {
//trace("web XML File Loaded");
}
};
webXML.load("web.xml");
var interactiveXML:XML = new XML();
interactiveXML.ignoreWhite = true;
interactiveXML.onLoad = function(success) {
if (success) {
//trace("interactive XML File Loaded");
}
};
interactiveXML.load("interactive.xml");
var avXML:XML = new XML();
avXML.ignoreWhite = true;
avXML.onLoad = function(success) {
if (success) {
//trace("audio video XML File Loaded");
}
};
avXML.load("audiovideo.xml");
var designXML:XML = new XML();
designXML.ignoreWhite = true;
designXML.onLoad = function(success) {
if (success) {
//trace("audio video XML File Loaded");
}
};
designXML.load("design.xml");
/**********XML files loaded**********/
/**********Create the Gallery*******/
function createXMLGallery(whichXML) {
var gallery:MovieClip = createEmptyMovieClip("gallery", getNextHighestDepth());
gallery._x = 70;
gallery._y = 170;
var numImages = whichXML.firstChild.childNodes.length;
var spacing:Number = 60;
var columns:Number = 3;
for (var i:Number = 0; i<numImages; i++) {
this.proj_name = whichXML.firstChild.childNodes[i].firstChild.firstChild.nodeValue;
this.proj_type = whichXML.firstChild.childNodes[i].firstChild.nextSibling.firstChild.nodeValue;
this.thumbHolder = whichXML.firstChild.childNodes[i].firstChild.nextSibling.nextSibling.firstChild.nodeValue;
this.picHolder = whichXML.firstChild.childNodes[i].firstChild.nextSibling.nextSibling.nextSibling.firstChild.nodeValue;
this.proj_media = whichXML.firstChild.childNodes[i].firstChild.nextSibling.nextSibling.nextSibling.nextSibling.firstChild.nodeValue;
this.description = whichXML.firstChild.childNodes[i].firstChild.nextSibling.nextSibling.nextSibling.nextSibling.nextSibling.firstChild.nodeValue;
this.proj_link = whichXML.firstChild.childNodes[i].firstChild.nextSibling.nextSibling.nextSibling.nextSibling.nextSibling.nextSibling.firstChild.nodeValue;
this.thumbViewer = gallery.createEmptyMovieClip("thumb"+i, i);
this.thumbViewer._x = (i%columns)*spacing;
this.thumbViewer._y = Math.floor(i/columns)*spacing;
this.thumbLoader = this.thumbViewer.createEmptyMovieClip("thumbnail_image", getNextHighestDepth());
this.thumbViewer.description = this.description;
this.thumbViewer.picHolder = this.picHolder;
this.thumbViewer.proj_link = this.proj_link;
this.thumbViewer.proj_name = this.proj_name;
this.thumbViewer.proj_type = this.proj_type;
this.thumbViewer.proj_media = this.proj_media;
this.thumbViewer.whichXML = whichXML;
this.thumbLoader.loadMovie(this.thumbHolder);
this.thumbViewer.onRollOver = function() {
var proj_name = this.proj_name;
captionFN(true, proj_name, this);
this.onRollOut = function() {
captionFN(false);
};
};
this.thumbViewer.onRelease = function() {
launch_mc._visible = true;
var url = this.proj_link;
var type = this.proj_type;
var media = this.proj_media;
launch_mc.onRelease = function() {
if (type == "Website") {
getURL(url);
} else if (type == "Interactive") {
trace(url);
fscommand("exec", url);
} else if (type == "Design") {
var shade:MovieClip = createEmptyMovieClip("shade", getNextHighestDepth());
with (shade) {
beginFill(0xFFFFFF, 75);
moveTo(0, 0);
lineTo(Stage.width, 0);
lineTo(Stage.width, Stage.height);
lineTo(0, Stage.height);
lineTo(0, 0);
}
shade.useHandCursor = false;
shade.onRelease = function() {
trace("OUCH");
};
shade.onPress = function() {
trace("OUCH");
};
var imageViewer:MovieClip = attachMovie("imageviewer", "imageView", getNextHighestDepth());
imageView._x = Stage.width/2-imageViewer._width/2-10;
imageView._y = Stage.height/2-imageViewer._height/2;
var closeMovie:MovieClip = attachMovie("close", "closeMov", getNextHighestDepth());
closeMovie._x = 568;
closeMovie._y = 75;
closeMovie._width = 48;
closeMovie._height = 19;
closeMovie.onRollOver = function() {
this._alpha = 50;
};
closeMovie.onRollOut = function() {
this._alpha = 100;
};
closeMovie.onRelease = function() {
imageView.removeMovieClip();
closeMovie.removeMovieClip();
shade.removeMovieClip();
thumb.removeMovieClip();
};
var thumb:MovieClip = createEmptyMovieClip("thumb", getNextHighestDepth());
thumb.attachMovie(url, "urlofmovie", getNextHighestDepth());
thumb._x = Stage.width/2-thumb._width/2-10;
thumb._y = Stage.height/2-thumb._height/2;
} else if (type == "Video") {
fscommand("exec", url);
}
};
var thumbInfo:MovieClip = createEmptyMovieClip("thumbinfo", getNextHighestDepth());
//Description field attributes
createTextField("desc", getNextHighestDepth(), 555, 170, 200, 300);
desc.border = false;
desc.multiline = true;
desc.wordWrap = true;
var my_fmt:TextFormat = new TextFormat();
my_fmt.font = "Verdana";
my_fmt.size = 12;
my_fmt.align = "justify";
desc.text = this.description+"
Media: "+media;
desc.selectable = false;
desc.textColor = 0xffffff;
desc.setTextFormat(my_fmt);
//End description field attributes
thumbInfo.loadMovie(this.picHolder);
thumbInfo._x = 315;
thumbInfo._y = 200;
};
}
}
/**************End Gallery*******************/

Movie Clips Or Grapic Symbols?
I have a simple project... but it involves A LOT of tweening and was attempting to keep the file size down and not involving hundreds of frames in the movie.

I was making each "image" or "feature" as a movie clip... should I perhaps just make this an animated graphic symbol? If I should leave them as movie clips.. how should I transition them from one to another... ie: movie clip 1 (image and text fade) -> movie clip 2 (image and text fade 2)... etc.

Looking for the best way to go about doing this...

Thanks!

Animated Movie Clips And Symbols
Ok here is what my problem is. I am trying to make movie clips that when you go over, they will flip and form the next button. The thing is, when I make the movie and add something, it cancels out the thing before. What do I do!

Problem With Symbols: Movie Clips
in my game i use two labels.
inside the first label i have a movie clip named "a" and inside the other label i have a movie clip named "b".
in a b's command i'm trying to insert a price to "a".

i tried putting in b's command : "_root._root.a_mc.price = 2;" (something like that), but it didn't work.

help me get out....please!!!

Movie Clips And Instances
Say I have a movie clip called Banana. How can I place an intance of Banana called Banana1 onto the stage using actionscript.

Dynamically Duplication Movie And Its Child Movie Clips
Hi all,

I have a movie clip in my library. This movie clip contains other movie clip also.

Now I want to bring this movie clip to the stage. I have used attachmovie method to do this. Whatever the new name, I have assigned to the movie clip in the AttachMovie method works well. But the movie clips inside that movie clip doesn't have the name.

How to name the movie clip and all its child movie clip.

Thanx

Nag

Keeping Child Movie Clips Looping
Let's say I have movie clip A which contains clips B. I want to tell B at some point to gotoAndPlay frame 'foo', and I know I can do this by the script a.b.gotoAndPlay("foo") somewhere on the parent timeline.

But A has several keyframes of animation that loop, and does this mean different instances of B for each?

What I get is B going to "foo" and starting to play that part but when A reaches the next keyframe of animation B jumps back to the start and resets to original frame.

I'd like B to keep looping it's new section of play regardless of what frame it's parent is on, can anyone help?

Movie Clips Versus Graphic Symbols
sicne movie clips take up less space on the time line what's the point of ever using a graphic symbol??

Symbols/ Movie Clips / Same Behaviour / Illustrator
hi guys !

i'm quite new in the world of flash. so sorry in advance for any silly question i'm surely gonna ask

i was wondering whether some of you could help me with the following.

- someone gave me an illustrator file where each layer is a different section of a map. i imported it in flash, and for every layer, i created a new movie clip in the library.
do i have to press f8 for every layer, or is there a quickest way to create a movie clip for each layer of an illustrator file ?

- let's say i now have my 325 different movie clips in my library. i'd like to create some common behaviour for all of them. for example, everytime you roll over one of them with the mouse, its color changes (and comes back to the initial one when rolling out).
same thing when you click on it: it would display some information, but different text for every movie clip (ideally it would be read from a structured text file - xml or something).
is there a way to create a parent class and make all my movie clips derive from it ? do you have an example of this with a short actionscript ?
please, don't tell me i have to declare the same onRollOver function for all my layers !

thanks a lot for your help.
s.

Symbols/ Movie Clips / Same Behaviour / Illustrator
hi guys !

i'm quite new in the world of flash mx 2004. so sorry in advance for any silly question i'm surely gonna ask

i was wondering whether some of you could help me with the following.

- someone gave me an illustrator file where each layer is a different section of a map. i imported it in flash, and for every layer, i created a new movie clip in the library.
do i have to press f8 for every layer, or is there a quickest way to create a movie clip for each layer of an illustrator file ?

- let's say i now have my 325 different movie clips in my library. i'd like to create some common behaviour for all of them. for example, everytime you roll over one of them with the mouse, its color changes (and comes back to the initial one when rolling out).
same thing when you click on it: it would display some information, but different text for every movie clip (ideally it would be read from a structured text file - xml or something).
is there a way to create a parent class and make all my movie clips derive from it ? do you have an example of this with a short actionscript ?
please, don't tell me i have to declare the same onRollOver function for all my symbols !

thanks a lot for your help.
s.

Tweening Movie Clips Symbols In Videos
When i tween movie clip symbols and export to video in flash 8, the twee don't work, but they work for graphic symbols. How can i solve this problem?

To Hide Instances Of Movie Clips
Hi, there.. I need help with a code.

I want to hide a movie clip when on a rollover (mouse) event

Preloading Child Movie Clips Before Functions Can Be Called
okay, so I have a timeline with 2 frames, frame one loads the XML data into the app and advances to frame 2 when done.

Frame 2 has a movie clip on it which displays an image dynamically and resizes it, with preloader.

On the actions layer of frame 2 I have the following:

stop();
if(XMLfeed.image != null) {
imageClip.setImage(XMLfeed.image);
}

this doesn't work because the actionscript in imageClip hasn't loaded yet, so the function isn't available.

if I put in a 3rd frame and move the actionscript on frame 2 to frame 3, it works because imageClip is loaded on frame 2, but this is a kludge.

Any ideas on how to solve this?

thanks
Jacob

Dynamically Creating Instances Of Movie Clips
I'm wondering if it's possible with actionscript and Flash MX2004 Professional to create instances of a movie clip at run time. For example, say I wanted to make a program that had a text box into which a user could type a number. Based on that number the program would display that number of instances of the movie clip. Further, I would like to be able to set the properties of those instances at runtime in actionscript.

Let me know if I'm unclear.

Thanks,
Legion

Changing Text In Movie Clips/instances
I created a movie that has text. I see that if I create different instances of this movie and change an instance or change it from the library it changes all of them. At least that's what's happening and that makes sense.

I want to duplicate the movie but have different text. I duplicated it in the library and created an instance of the duplicate version.

If I change the text in the duplicate or in an instance of it, it changes the original in the library and all instances of it -- all instances both original and duplicate. All I want to do is end up with 2 movies that are essentially the same except one line of text is different. I obviously don't want to recreate it each time I need it and I'm going to need several versions of it.

It's obvious that I'm new, so thanks.

Changing Text In Movie Clips/instances
I created a movie that has text. I see that if I create different instances of this movie and change an instance or change it from the library it changes all of them. At least that's what's happening and that makes sense.

I want to duplicate the movie but have different text. I duplicated it in the library and created an instance of the duplicate version.

If I change the text in the duplicate or in an instance of it, it changes the original in the library and all instances of it -- all instances both original and duplicate. All I want to do is end up with 2 movies that are essentially the same except one line of text is different. I obviously don't want to recreate it each time I need it and I'm going to need several versions of it.

Page 2 - Preloading Child Movie Clips Before Functions Can Be Called
Okay, I think I found the "Best practices" solution, and it seems to work...

I export the clip for action script on the first frame from the library...

Then in the first frame of artist_image I have:

ArtistImage.init = function() {
var x = y;
etc. etc.
}

Object.registerObject("artist_image",ArtistImage);
ArtistImage.prototype = new MovieClip();

ArtistImage.prototype.setImage = function(imagename) {
//do it all here
}

This seems to work, and loads before the function call is made.

What do you think of this?

Poll: Do You Use Graphic Symbols, Or Movie Clips For Animations In Your Movies?
Hey all, I usualy use Movie clips when I'm making a website, but recently I've started using Graphic symbols when I'm creating animations because it allows me to preview the animation in the timeline, and I can control it's location without adding any code to the script.


What do you guys think about this anyone else do this?

any reasons why I shouldnt?

Changing Instances Of Movie Clips Within A Scrolling Background
Hey guys,
this prob sounds quite easily to resolve but I couldnt find a solution yet.What I want to do is to give the illusion to move a movie clip, a person, with the aid of a scrolling background. when the person arrives in front of another movie clip (part of the scrolling background) and the player presses a key, I want this movie clip to change the appearance.
I tried different possibilities like

Code:
onClipEvent (enterFrame) {
if (scrollingbackground._x=positionoftheperson) {
if (Key.isDown(Key.UP)) {
_root.scrollingbackground.movieclip1.gotoAndStop(2);
}
} else {
_root.scrollingbackground.movieclip1.gotoAndPlay(1);
}
}

but nothing worked
could anybody please help me?? thanks a lot!!!!
Putain

Changing Size Of Child Clips To Match Parent Movie Clip?
I have a program that is dynamically loading images into a nested movie clip. The Parent movie contains the two separate movies within it and images are to switch back and forth in them. I need to know how I can use action script to load these nested movies to the exact dimension of the parent movieclip.

Here is my code:

onClipEvent (load) {
StagePictures._lockroot = true;

e_mc.loadMovie(_root.PathText+_root.imageClips[0]);

}
onClipEvent (enterFrame) {
if (Key.isDown(a number)) {
if (Key.isDown(Key.something)) {
if (Key.isDown(a number)) {
_root.StagePictures.e_mc.createEmptyMovieClip("Sec ondClip" , 3);
_root.StagePictures.e_mc.SecondClip.loadMovie(_roo t.PathText+_root.imageClips[1]);
_root.ScoreBox.text = scvar+1;
_root.Command.text = _root.imageCommand[1];
_root.Response.text = "Correct!";
}
}
}
}

StagePictures is the parent clip, e_mc is a child, and SecondClip is a child within e_mc.

Both e_mc, and SecondClip are loading the dynamic images which are the paths labeled _root.PathText+_root.imageClips[0, and 1];

The size of the images need to be contained within the size of the parent clip of both called StagePictures.

How can I set the size of the two nested clips to match the parent?

Thanks,
sam

Create Container Movie Clip And Child Clips At Design Time?
It's always powerful and dynamic to use "createEmptyMovieClip" and "attachmovieclip" at run time. But how to create this relationship of clips at design time so that an empty movie clip can hold several child movie clips?

Thanks!

Making Dynamically Created Movie Clips Instances Re-draggable
This is a Flash 8 / Actionscript 2 problem

The application allows the user to create multiple instances of a dot
by clicking on the original dot - and then drag the instances to position
them on the stage (it's part of a game)

I need to allow dots to be re-dragged - but to do that need to detect the
instance name of the dot under the mouse pointer (otherwise I can't turn
the dragging on)

this is what I've got so far...

numberOfDotDuplicates = 0;

dot.onPress = function()
{
numberOfDotDuplicates++ duplicateMovieClip(_root.dot,"dot"+numberOfDotDupl icates,getNextHighestDepth())
_root["dot" + numberOfDotDuplicates].startDrag(true);
}

/*
This bit below is not realy part of the problem
- but it feels like an inelegant workround
I've had to use a listener to stop the dragging
because the onRelease event is only detectable
if it happens over the original 'dot' (where the
corresponding onPress event was detected)
*/
var myListener:Object=new Object()
Mouse.addListener(myListener);
myListener.onMouseUp = function()
{
stopDrag();
}

Thanks for taking the time to read this

Simon

Child Instances
hi,

if, you have a clip, which is already on the stage, inside of which is a child clip, which itself is made up of 2 keyframes. The parent clip also has export to actionscript set.

and then you attach another or the parent clips to the main stage.

my question is, if you set the _currentframe (say to frame 2) of the child clip, of one of the parent clips, will that also set the child clip to frame 2, in the other parent clip? and does the child clips having instance names effect anything??

thanks

phil

Duplicate MC And Child Symbols From Library
Hi, guys

I'm in the middle of a project in wich I cannot use Actionscript to generate some content because first there is no Database and two the information its kind of unpredictible.

The project its a Directory Like movie where you can find a List of Poeple and Details.

what I want is:
Duplicate an MC I have in the Library but at the same time make a Duplicate of all the Child Symbols

That would make me things a lot easier.

I haven't found a way to do something like that, I hope there is.

thanks a bunch in advance
alex

Creating Symbols/instances
When you create a graphic and then select Convert to Symbol, does that graphic that's already on the stage convert automatically to an instance or do you have to delete it and drag the newly created symbol from the library?

Thanks

Swap Several Instances Of Symbols
Hi there,
my project consists of several movies using a lot of the same symbols which are to be changed easily. So I decided to use a shared authoring library for the next version. As I don't want to rebuild all the movies from scratch I thaught I might just import the new symbols from the shared library and use swap symbols.
Now the question:
Is it possible to change several/all instances of one symbol within the movies (one movie at a time!) in one go?
(My movies consist of several scenes using those symbols.)


Thanks for any help inadvance
Cheers Cherry

Instances, Symbols & Actionscript
Ok guys, it seems I'm missing something fundamental here.

I want to create symbols (movie clips) that contain certain ActionScript for onClipEvent(load) and onClipEvent(onEnterFrame).

I have trouble understanding how script could be attached to a symbol so that all instances of that symbol contain that script.

If I create a new movie clip symbol A and write the load and onenterframe event scripts for it, the next copies of A that I drag and drop onto the scene DO NOT have the script.

The way I want it is that I have symbol A in the library and when I drop it from there to the scene, it already contains the code for the load and onenterframe clip events. How can it be done ?

[CS3] Instances Of Button Symbols
Hello,

I'm having troubles with creating instances of a Button Symbol. I select Insert -> New Symbol, choose Button and enter a name. The Button ends up i my library, and I edit it to look like I want (using the Text Tool). After that, however, when I drag it multiple times to the stage to create multiple instances they all seem to be the same (even though I put separade instance names on them): to edit a button, i double click with the selection tool on it, and I'm able to edit the text (on it. However, the text on all the buttons change because the symbol itself changes! I only want to edit the instance of the button. How do I do that?

Thanks!

Symbols In A Button Become Instances?
I have a Movie Clip>Button>Dynamic Text.
I have also tried Movie Clip>Button>Movie Clip>Dynamic Text

The results are the same when you have a symbol whatever it might be inside a button that symbols intstance name becomes instance followed by some number.

I need to kow how I can have thats symbol instance name show I'm not sure why a button is doing this but, I need the Dynamic Text to remain in the button.

The Proper Way To Refer To Instances Of Symbols
Hey, quick question on what people feel the "standard" is for Flash programming when you name an instance of a symbol so it's accessible to an AS code your using. Usually, I have my instance name equal to the symbol name unless I'm using 1 symbol for MANY (i.e. more than 5) different things (different actions, movements, events, etc). Is this an ok thing to do when working with a group of people? (This situation would be analgous to initalizing a varible in the when your defining the arguments of a function/class in C++)

Instances Change To Other Symbols After Reloading
I replaced symbols with the new symbols. I've tried numerous methods including import from an external library. Instances of of some of these replaced symbols are linked to different symbols when the fla file is reloaded.

For example, five instances of Symbol 8 are suddenly become instances of Symbol 6. The strangest part is that it only happens after I have saved, closed and reloaded the fla file.

Does anybody have a clue as to what might cause this would happen or how to eliminate the problem. BTW, it happens on other computers using the same file.

Naming Instances Of Graphics Symbols
I'm having a good time reading through the Flash Anthology, but every now and then, I get confused. On several occations, Steven gives examples where Graphic Symbols are involved, and he names their instances like if they were Movie Clips. This is something that I cannot do in my copy of Flash MX Pro 2004. I can name instances of Movie Clips and Buttons, but not the graphis symbols. Is it just me, or can't you name instances of Graphic Symbols? And if you can, how do I do? I figure this is basic Flash, but I havn't been able to find the answer else where. So that's why I turn to you in hope to removing this confusion.

Understanding Parent/child Classes Vs Nested Symbols And Accessing Their Variables
G'day, this problem has been doing my head in for the last 2 days. I've got a button and two text fields located inside a loginBox movieClip which is linked to the class loginBox. The textfields are named username and password. The button is called loginBoxButton and when it is pressed all I want it to do at this stage is trace the value of username and password. Later I'll be sending data over a XMLSocket to a python backend.

My code looks like this:


Code:
package
{
import flash.display.SimpleButton;
import flash.events.MouseEvent;
import flash.text.TextField;
import loginBox;
public class loginBoxButton extends SimpleButton
{
public function loginBoxButton()
{
this.addEventListener(MouseEvent.CLICK, clickHandler);
}
public function clickHandler(event:MouseEvent):void {
trace("clickHandler detected an event of type: " + event.type);
trace("the event occurred on: " + event.target.name);
trace(loginBox.username);
}
}
}
which throws up 1119: Access of possibly undefined property username through a reference with static type Class. on the trace(loginBox.username); line.
I've also tried

trace(this.parent.username);

which gives me this: 1119: Access of possibly undefined property username through a reference with static type flash.displayisplayObjectContainer.

which after some thought brought me to the conclusion I was confusing class inheritance with nesting objects inside each other.

So looking through the documentation on DisplayObjectContainner I though loginBox should act as a container for the 2 textfields and the login button but when i tried trace(loginBox.getChildByName("username")); It threw back

1061: Call to a possibly undefined method getChildByName through a reference with static type Class.

Which was a similar error to the first one.


At this point I'm completely stuck, and stuck because I don't understand how flash's implementation of object orientated programming works (although I have done a lot of c++ OO work), or how it nested stage objects should be accessed within code. Also, and this is a more basic question, was i right in assuming everything on stage if exported / given a name has a corresponding class in code.



Any help very, very, very much appericated

DuplicateMovieClip Not Copying "child" Movie Clips
I think I'm missing the boat here, what am I missing?!?!!

1) I have a container movie clip instance on the stage at design time.

2) At runtime a number of "child" movie clips are attached to the container clip instance.

3) I try to use the duplicateMovieClip method to duplicate the entire container clip instance.

4) Only the original container clip is duplicated. The movie clips that were attached to the container at runtime are NOT duplicated along with the container clip itself.

I'm sure I'm missing some basic concept here....so please...point me in the right direction!

Thanks!

Button Action In Movie Clips
ihave a button in a movie clip with the following actions

on realease
go to scene 3,1

(something like that)

but it wont work, i know it has to do something with levels, but i cant remember how to do it, i kow it neeeds one of these / or something like that but i dont know where or how to, please help me thanks

Rollover Action For Movie Clips
hi,
Doesn't anyone know how to make a movieclip play once your mouse roll over it. Just like the navigation at www.evb.com. thanks

Multiple Movie Clips Doing Same Action?
hey all.
im working on a basic little game cup-under-ball game, with a twist. problem is, when you lift up a cup, only one cup will lift up, which is good, but the 'prize' object applies to all the other cups. how do i fix this.

thanks!
(enclosed is the flash im working on)

Action On Movie Clips Question ....
Hi,

I have a movie clip which is shaped as a rectangle and has the following TEXT inside "ABOUT".
When I click about it loads a swf file which contains info. about myself.

But when I click on the movie clip (it has a button hidden within it) it disappears and show the sef file on the same page.

How can I make the movie clip NOT disappear and show the swf file on that flash page ?

I am using FLASH MX.

Thanks

Movie Clips And Action Script.
I'm using flash MX 2004 and am a newbie...

I've created a sort of television that has three buttons to play, go back to the beginning and stop the television from playing. I saved it as a movie clip to use for other scenes. In the first scene it was not a movie clip and worked fine. However when I saved the television as a movie clip and imported it into another scene the actionscript for the buttons is no longer functional...

Why is that?

I Need Some Help With Movie Clips / Action Script
HI everyone, my names MICHAEL I need some help with movie clips, I am a newbie to action script, i gess there is a really easy way to solve my problem I just don’t know it.

Ok I have created a web site, I have used mainly buttons with
on (release) {
gotoAndPlay(50);
}
To load different pages which all works nicely, great.

The problem is when I use a move clip, to gotoandplay frame 30 say, When you click on the movie clip, a menu appears beside it with other options, there are four options these are BUTTONS. I need them to go to a certain frame in the timeline, but not their timeline the main timeline.
I cannot use gotoAndPlay(50); because its not going to the correct timeline

I have also used

on(release) {
loadMovie("blar blar blar/How to play.swf",_root.dropZone);
}
But I don’t like this method, it works but when I load the external swf, it appears shrunk even tho is it the same size as the movieclip I am loading it into.

I hope I have explained myself well, If any one can help it would help us out alot thanks.

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