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








Attaching MCs Onto A Motion Path From Library


hello all...

so here is my situation...i would like to create an environment where on my stage i have an animation path (motion guide) that, say, 50 or so MCs travel along in my scene. They all follow the same path almost like a group of train cars strung together following RR tracks

The part i am struggling to set up is to do the bulk of this through Actionscript, in a manner where all these "traincars" are library items that are attached to this motion path and then carry out their animation along that path.

i have dug around on the forums and found what i think is a good starting point but i need some help in figuring out where to go as this is a bit beyond my skill level. if anyone would be so kind as to help me wrap my head around this i would be very grateful

this is what i have so far...i know its not much but as i said this is a bit beyond my scope:


Code:
var i:Number = 0;
//"loader" being the dummyMC i load content into and "ant" being the first library item (out of roughly 50) that gets loaded onto the stage
loader = this.attachMovie("loader", "loader_"+i, this.getNextHighestDepth(), {_x:0, _y:0});
ant = cell.attachMovie("ant", "ant_"+i, cell.getNextHighestDepth(), {_width:133, _height:100, _x:40, _y:10});
again if anyone could help i would really appreciate it...thanks for your time!




FlashKit > Flash Help > Flash ActionScript
Posted on: 06-28-2006, 11:32 AM


View Complete Forum Thread with Replies

Sponsored Links:

Attaching MCs Onto A Motion Path From Library
hello all...

so here is my situation...i would like to create an environment where on my stage i have an animation path (motion guide) that, say, 50 or so MCs travel along in my scene. They all follow the same path almost like a group of train cars strung together following RR tracks

The part i am struggling to set up is to do the bulk of this through Actionscript, in a manner where all these "traincars" are library items that are attached to this motion path and then carry out their animation along that path.

i have dug around on the forums and found what i think is a good starting point but i need some help in figuring out where to go as this is a bit beyond my skill level. if anyone would be so kind as to help me wrap my head around this i would be very grateful

this is what i have so far...i know its not much but as i said this is a bit beyond my scope:


Code:
var i:Number = 0;
//"loader" being the dummyMC i load content into and "ant" being the first library item (out of roughly 50) that gets loaded onto the stage
loader = this.attachMovie("loader", "loader_"+i, this.getNextHighestDepth(), {_x:0, _y:0});
ant = cell.attachMovie("ant", "ant_"+i, cell.getNextHighestDepth(), {_width:133, _height:100, _x:40, _y:10});
again if anyone could help i would really appreciate it...thanks for your time!

View Replies !    View Related
Sound Only Attaching From Preloader Library Not Main Movie Library
Hi guys, i've got my main movie with sounds used in classes attached from the library via attachSound. works fine when run on its own, but when run through a seperate preloader swf it only works when the sound is in the preloaders library.

Any help would be much appreciated.

View Replies !    View Related
Cannot Export An Avi Of Motion Along A Path When Path Is Specified With Action Script
Hello!
I have the following problem: I am using Flash 8 Professional to produce a series of avi files showing the motion of a dot along different paths. Whenever I use the drawing tools to draw the path everything is all right: I can export both a swf and an avi file showing the motion. The problems start when I use action acript to specify the path: then a swf can be exported, but not an avi file (Flash acts as if it is exporting but the avi file produced shows only a stationary dot). Can anybody help me?

View Replies !    View Related
[Help] Attaching An MC To An MC In The Library
Hey guys, I was wonderinf if its possible to add an MC to an MC thats in the library.

Say I had "closetMC" inside of the library and I wanted to add "shirt1" from the timeline into "closetMC". Is this possible? And if so, how could I achieve this?

Thanks a bunch!

View Replies !    View Related
Attaching Mc From Library In AS3
Hello:
I´m searching, not finding some help about attaching MCs from library to stage with AS3. I can´t understand what´s the problem. I´ve tried dozens of solutions but without success. Please anyone has an idea.
Here is my code:

ActionScript Code:
function boton(nombre_mc:String, other_mc:String){
    this[nombre_mc].buttonMode = true;
    var container_mc:MovieClip = new MovieClip();
    addChild(container_mc);
    var theClassName:Class = getDefinitionByName(other_mc);
    var theClass:MovieClip = new theClassName();
    this[nombre_mc].addEventListener(MouseEvent.MOUSE_OVER, efecto);
             function efecto ($event:MouseEvent) {
                     $event.currentTarget.gotoAndPlay(2);
                     var caraBio:* = new tempClass();
                     container_mc.addChild(theClass);
    }
}
boton("First_mc", "FirstAA_mc");
The First_mc and the FirstAA_mc are both linked with the same name to AS.
When I test the movie, it says:
error 1046
error 1118
error 1180
Anybody knows how to meka a function to attach a library MC.
Thanks.

View Replies !    View Related
Attaching MC To Variable Path
Hi

I have a number of mcs on the stage (for arguments sake "parent mcs".

Depending on which parent mc i have selected id like to attach a movie from the library (child mc) to the relevant parent mc on the stage.

so i've setup a var called parent mc:

var parentmc = "_root.parentmc"+count;

so that i can do this

parentmc.attachMovie(blahblah);

but this doesnt work because ive treated it as a string. How to i target a dynamic movieclip instance?

View Replies !    View Related
Attaching Mc's To Other Mc's Using Path Variables
Hi all,

I need to attach a mc or textfield to a parent mc using a path variable (backgroundBoxPath in this case), and manipulate the attached mc with reference to its parents parameters.

However, although trace reports the values of the parameters that you would expect, the results on screen seem to show something completely different, bearing no relation to the figures reported in trace.

Can anyone tell me why this doesn't work as I expect it to?

code: _root.createEmptyMovieClip ("holdingLayer_mc", 1);

_root.holdingLayer_mc.attachMovie ("square1", "backgroundBox_mc", 1);

backgroundBoxPath = _root.holdingLayer_mc.backgroundBox_mc;

backgroundBoxPath._x = backgroundBoxPath._y = 20;

backgroundBoxPath._width = backgroundBoxPath._height = 20;

backgroundBoxPath.attachMovie ("square2", "foregroundSquare_mc", 1);

insetBoxX = backgroundBoxPath._x;

insetBoxY = backgroundBoxPath._y;

insetBoxWidth = backgroundBoxPath._width - 2;

insetBoxHeight = backgroundBoxPath._height - 2;

backgroundBoxPath.foregroundSquare_mc._x = insetBoxX;

backgroundBoxPath.foregroundSquare_mc._y = insetBoxY;

backgroundBoxPath.foregroundSquare_mc._width = insetBoxWidth;

backgroundBoxPath.foregroundSquare_mc._height = insetBoxHeight;

trace ("backgroundBoxPath.foregroundSquare_mc._x = "+backgroundBoxPath.foregroundSquare_mc._x);
trace ("backgroundBoxPath.foregroundSquare_mc._y = "+backgroundBoxPath.foregroundSquare_mc._y);
trace ("backgroundBoxPath.foregroundSquare_mc._width = "+backgroundBoxPath.foregroundSquare_mc._width );
trace ("backgroundBoxPath.foregroundSquare_mc._height = "+backgroundBoxPath.foregroundSquare_mc._heigh t);

Bill

View Replies !    View Related
Attaching Movieclip To A Path
hi
im just getting started in AS, using MX.

how can i attach a movieclip to a path on the stage, and have it follow the path at a given speed and direction?

just a push in the right direction would be great.

thanks
ben

View Replies !    View Related
AS For Attaching MC's On A Curved Path
I posted this on Flash 8, but I later realised that it would be better to have put it here. I asked one of the mods to replace it, but that hasen 't happened so I'm posting it again

I've been experimenting with for loops lately, and just now, I've found a really cool effect to grow grass using AS.
I just designed one blade and gave it a linkage ID of "grass". On the main time line I added this:


Code:
for(i=0;i<800;i++){
var t:MovieClip = holder_mc.attachMovie("grass","grass"+i,holder_mc.getNextHighestDepth());
t._x = Math.random()*700;
t._y = 400;
t._xscale = Math.random()*20;
t._rotation = Math.random()*10;
t._yscale = Math.random()*30;
}
Naturally, this is put after having created an empty clip holder_mc.
And this gives a really nice looking effect of random grass growing on your screen.

The only problem is that this is limited to a straight line of grass, and so I would like to know: is it possible to "grow" grass the same way, but on let us say a round, circular shaped MC or maybe just a bent path if that's easier to code

View Replies !    View Related
Attaching A Symbol To A Path Using AS 3.0?
Is there a way to attach a symbol to a guided path in actionscript itself? for attaching multiple symbols to the path to be played at once?

Or is it better to use coordinates to send them on a path?

View Replies !    View Related
Attaching A Library MC From A Loaded Swf.
//on (release) {
// _root.main.attachMovie("att2", "newname2", 1);
//}

This does not work. Any help?

Trying to attach a movie clip from inside the Library to a blank MC on Main Stage from a loaded swf movie.

Is this possible?...or should my code work with better path.

M

View Replies !    View Related
Attaching An MC From The Library W/ Code Already...
I need to attach my character from the Library w/ code on the actuall MC, not within. I DO NOT want to use a blank mc to store him in then add the code on the inside. He needs to load w/ code on his parent MC from the library.

-Tyler

any ideas?

View Replies !    View Related
Attaching Scrollbar From Library
Hi

I'm trying to use the Flash MX scrollbar in MX 2004 but I am having problems with it. If you are wondering why I don't use the MX 2004 textarea component, it is because it is pants and has more bugs than your average garden.

I'm creating my textfields using createTextField and then attaching the scrollbar from the library thus:

/////////////////
_root.question_mc.attachMovie("FScrollBarSymbol"," insScroll_mc",100);

_root.question_mc.insScroll_mc.setScrollTarget("_r oot.question_mc.ins_txt");

_root.question_mc.insScroll_mc.setScrollContent("_ root.question_mc.ins_txt");

_root.question_mc.insScroll_mc._y = _root.question_mc.ins_txt._y;

_root.question_mc.insScroll_mc._x = _root.question_mc.ins_txt._x + _root.question_mc.ins_txt._width + 25;

_root.question_mc.insScroll_mc.setSize(_root.quest ion_mc.ins_txt._height + _global.textBoxSpacing);

_root.question_mc.insScroll_mc.setSmallScroll(14);

_root.question_mc.insScroll_mc.setEnabled(true);
/////////////////////

I found TWO methods in the MX help for setting the target textfield for the component, yet neither seems to work. All the other changes I make to the scrollbar including setSmallScroll work, but not target.

Can any bright sparks out there shed some light on this little puzzler?

Ta

Barry

View Replies !    View Related
Attaching A MC From A Library And Setting Its X And Y
Hi all!
I have a movie in the library which I want to attach to the stage by code. Here's the code I've been using:

Code:
count = 0;
_quality="High";
onEnterframe = function () {
attachMovie("main", "circle"+count, count++);
};
This code works, but it puts the attached MC (circle) in the middle of the stage. How can I set its X and Y coordinates to place it exectly where I need it? I tried a few things, but the code I tried shifted the entire stage instead of that MC alone... So how can I do it?

Thanks in advance!

View Replies !    View Related
Attaching Several Movieclips From Library?
Hey

I have a for-loop where I want to attach several movieclips from library. I have tried:


Code:
var movie:MovieClip;

for (i = 0; i < 20; i++)
{
movie = attachMovie("MCname", "MCname"+i, getNextHighestDepth);
movie._y = 31+31*i;
}
When I test the movie only the last clip shows. Is this because it only works for 1 clip. I've tried some other things like duplicateMovieClip and so on, but can't get it to work..

View Replies !    View Related
[F8] Attaching A Mc From The Library Into A Loaded Swf
hey folks

I'm trying to do this


Code:
targetMC.attachMovie("bullet_bar", "bullet_bar", 20);


the targetMC is the location of another loaded swf file. the bullet_bar movieclip is in the library of my root swf

can this work cos I'm having a few problems

View Replies !    View Related
Attaching MC From Library By Function In AS3
Hi everyone:
I´m trying to create a mc (that works as a button). I´d like when the cursos goes over it, the mc run to frame 2 (this is obteined thanks to xxneon in other thread) and also that it put a mc that exist in the library.
If the mc is with the "export for as" checked, and the name is MC_mc, why this doesn´t work:

ActionScript Code:
function boton(nombre_mc:String, cara_bio:String){
    this[nombre_mc].buttonMode = true;
    this[nombre_mc].addEventListener(MouseEvent.MOUSE_OVER, efecto);
    this[nombre_mc].addEventListener(MouseEvent.MOUSE_OUT, inicio);
    function efecto ($event:MouseEvent) {
        $event.currentTarget.gotoAndPlay(2);
        var caraBio:cara_bio = new [cara_bio]();
        addChild(DisplayObject(caraBio));
    }
    function inicio ($evente:MouseEvent) {
        $evente.currentTarget.gotoAndStop(1);
    }
}
boton("other_mc", "MC_mc");
(other_mc is in the stage yet)
Thanks

View Replies !    View Related
Attaching Objects From Another Library
I have the following scenario: I have a main.swf, and it loads a lib.swf, in which library are some movie clips that I want to attach in main.swf. Is it possible? (PS: I do not want to attach the symbols inside the loaded lib.swf. What I want is to use lib.swf's library in main.swf).
Thank you.

View Replies !    View Related
Attaching MovieClips Not In The Library
I'm just coming back to Flash after not using it for a few years, and I'm struggling with a particular aspect of ActionScript 2 (I'm still using Flash 8). I am creating something along the lines of an image grid or "video wall" of still images. The image grid will randomly show different images, and I want any cell in the grid to have access to the full array of images to choose from.

I want to dynamically load in the individual PNG bitmap files from the server to facilitate swapping them out, rather than baking them into a SWF. At the root level, I've managed to use MovieClipLoader to load my PNG files into a dynamically generated array of MovieClips. My image grid is a bunch of instances of of a MovieClip which contains a mask, decorations, and a placeholder MovieClip for the images.

What I can't figure out how to do is attach the PNGs to the placeholder clips. It seems like my two options are attachMovie and attachBitmap. However, both of them require you to specify a linkage ID to a library asset, which I do not have- I have an array of MovieClips not contained in the library!

I'd really appreciate it if someone could point me in the right direction.

View Replies !    View Related
Attaching A Clickable MC From The Library
Hi there,

When I click my 'hit_mc', 'hitarea_mc' gets placed on the stage from the library. When I click 'hitarea_mc', I want it to disappear.

So Ive done the following, but the newly attached hitarea_mc refuses to be clickable. How would I tell AS to make it thus ....
Thanks..

Code:
var a:Number = Stage.width/2;
var b:Number = Stage.height/2;

function attach (){
_root.attachMovie("hitarea","hitarea_mc",10,{_x:a,_y:b});

}

hit_mc.onRelease = function(){
attach();
}
hitarea_mc.onRelease = function(){
this._alpha = 0;

}

View Replies !    View Related
Attaching MovieClip From Library (Please Help)
Hello

I have created a textfield and then attached a movieclip as a background on top of which I wanna place the text field just like a button.

Here is the code

var txt:TextField = new TextField();

var bg:MovieClipClass = new MovieClipClass( );
bg.addChild( txt );

txt.text = "Hello World!!";
addChild(bg);

The movieclip and text field are displayed on the stage but the text field is not on top of the background clip it is always away from the clip I have even tried

assigning the moviclip x and y coordinate to text field but does not work.

Any help will be well appreciated

Thank in advance

View Replies !    View Related
Attaching MovieClip From Library (Please Help)
Hello

I have created a textfield and then attached a movieclip as a background on top of which I wanna place the text field just like a button.

Here is the code

var txt:TextField = new TextField();

var bg:MovieClipClass = new MovieClipClass( );
bg.addChild( txt );
txt.text = "Hello World!!";
addChild(bg);

The movieclip and text field are displayed on the stage but the text field is not on top of the background clip it is always away from the clip I have even tried
assigning the moviclip x and y coordinate to text field but does not work.

Any help will be well appreciated
Thank in advance

View Replies !    View Related
Attaching Mcs To A Motion Guide..
Hi everyone,

I need to attach a series of mcs to a curved line. These mcs are attached in real-time, they do not tween, just attach at intervals one after another. Its hard to explain i know. When the user presses a button on the screen the first mc appears at the start of the curve, another press creates another mc perhaps 10px inwards on the line and so on.

Does anyone know any actionscript that will cause these mcs to attach to this motion guide?

Thanks, and merry xmas!!

Steven.

View Replies !    View Related
Attaching A Symbol To The Cursor On A Path
I'm thinking this will involve some actionscript so I'm posting here.

I'm working on the menu for a site. Right now it's simple - text links with a seperating black Line down the right side.

link 1 **|
link 2 **| <-- Line
...**** ***|
link 20 |

What I want to do is this: have a small graphic (ie. an arrow) that can move vertically up and down the seperating line shown above, according to the users mouse position vertically. It can't move horizontal in any way though, it needs to be restricted to that up/down path.
If a link is visited, that's the new default position for the arrow when the user's mouse leaves the menu. On load, the arrow will sit at the first link.
When the user moves the mouse into the menu again, the arrow needs a small one second delay while it moves to the vertical position of their mouse.

I know basic Flash 5, but haven't used it in a long time.
Any help, samples, or tutorials would _very_ much appreciated.

TIA.

View Replies !    View Related
Attaching Sound From Library Using Variables
I´ve been having a huge problem with flash lately. I´m setting up a site using a whole lot of levels. And on one level I'm using a soundpanel to control the background music on the site. I wanted to give the user the opertunity to choose between three different types of background music. But that requires a great deal of bandwidht for the user. So I thought I´d load each song in on a different level with a preloader.

I started by setting a variable for the swf file being loaded as the sound file and another variable for the linkage identifier being used to attach the soundobject directly through the library. I then use this variable to load the sound into a soundcontainer on the soundpanel level. My problem is that the sound doesn´t even play or anything. Has anyone tried this before... or have any experience using variable with the sound object. I´ve been staring at this same problem now for days and it´s driving me insane. I´ve tried at least 7 different appraches changing the way I use the variables but nothing works.

View Replies !    View Related
Attaching MovieClips Fromthe Library
Hey could someone help me out here?

I am using this code to attach a library movieClip with the linkage instance name of can 15 times to the stage when running. This works fine but i am having heaps of trouble as i am trying to get the var x to distribute at increments of 20 along the y axis which is currently set to 355.

So when it is running it would look something like this::

[] [] [] [] [] [] [] [] [] [] [] [] [] [] []


the cod i am using on frame 1 of the movie is:

totalCans = 15;
screenWidth = 550;
screenHeight = 400;
for (var i=0; i<totalCans; ++i){
var name = "can"+i;
_root.attachMovie("can", name, i);
var x = random(screenWidth);
var y = 355;
_root[name]._x = x;
_root[name]._y = y;
}

View Replies !    View Related
Attaching Mc From Library Of A Dynamically Loaded Swf?
Hi..
I beleive there is some way to solve this problem. I want to attach a movie clip from the library of the swf file with is loaded dynamically into another swf file. The mc loads if it is available in the root swf file.
Can any one help me out?

View Replies !    View Related
Yet Another AS 2.0 Problem: Attaching A Class To A Library Mc
Hey all,

I know everyone must be sick of OOP questions, but I can't find the answer to this one anywhere in the usual tutorials.

Here goes:
When you create/convert a movieclip, you have the option to link the movieclip to an AS custom class, I assume besides MovieClip class. But I don't fully understand the relationship between the movieclip and the class. For instance, how would I reference the movieclip from the class? Is it the class itself (so if I wanted to change the _x of the movieclip onstage in a function, would it just be this._x = 20;?)

So if anyone understands this relationship or has a tutorial link that explains it, I would greatly appreciate it. Thanks a lot!

Dave

View Replies !    View Related
Attaching Code To Movieclips In Library
Im making a game and i want to load in with actionscript movieclips in the library. However, i want these movieclips to contain code that will load with them onto the stage, and from what ive heard attachMovieclip doesnt do this. I dont want to have a clip existing on the stage in the begining and then use duplicateMovieclip. Anyone know if this can be done or how to do it?

View Replies !    View Related
[F8] Attaching Movieclip From Library In A Class?
This is really stupid but I've never used external classes (.as) files before and I'm having some trouble attaching movieclips from inside the class.
I have a movieclip in my library and just want to attach it from the Testing class, why isn't it working?


PHP Code:




mytest.fla

var blah:Testing = new Testing();








PHP Code:




Testing.as

class Testing extends MovieClip{
    function Testing(){
        attachMovie("photo_mc", "photo", this.getNextHighestDepth());
    }
        
}

View Replies !    View Related
Get Properties Of Library Clip BEFORE Attaching
Hi, not sure if this is possible, seems not, but I couldnt find anything about it.

Is it possible to get the properties of a library clip that is set for export on first frame without first attaching it?

I'd like to get the size of my library clip before I attach an instance of it.

View Replies !    View Related
Attaching Movie Clip From Library
I am having trouble loading a movieclip from the library.

This is the script I have

attachMovie(logo, logo1, 5)

What am i doing wrong?

View Replies !    View Related
Attaching ActionScript To MovieClips In The Library
Hello everyone! Here is a question for ya.

In my library I have a bunch of movieclips that are dynamically going to be placed on my stage. Is there a simple method of attaching ActionScript to these movieclips so that when they are used on the stage, they have the script applied to them already?

Thanks in advance!

View Replies !    View Related
Attaching Images From The Library To Stage?
How can I attach images from the library, without converting it to a movieclip, to the stage or empty movieclip. My reason for this is because I have 100+ images in my library and I want to avoid converting them all to individual movieclips for production sake.

Thanks...

View Replies !    View Related
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?

View Replies !    View Related
Problem Attaching A Movie From Library
I modified the code for the hover captions that is on kirupa.com
The reason i had to try and modify it is because i am generating thumbnails from an xml document and when i want to use the hover caption it is creating the hover on the depth of -16745 or something and all of the thumbnails are on levels 1-10 or however many there are
I can't seem to figure out how to get the caption to be above the thumbnails.
here is the code i have so far, hope someone can help. but this code so far doesn't show the caption image that I have in my library
argh

Code:
captionFN = function (showCaption, captionText, bName) {
if (showCaption) {
//var caption:MovieClip = _root.createEmptyMovieClip("hoverCaption", getNextHighestDepth());
//trace(this.getDepth());
this.attachMovie("caption", "cap_mc", this.getNextHighestDepth());
//cap_mc.caption_txt.text = captionText;
if ((bName._width+bName._x+cap_mc._width)>Stage.width) {
xo = -2-cap._width;
yo = -17;
} else {
xo = 2;
yo = -17;
}
cap_mc.onEnterFrame = function() {
cap_mc._x = _root._xmouse+xo;
cap_mc._y = _root._ymouse+yo;
cap_mc._visible = true;
};
} else {
delete hoverCaption.onEnterFrame;
cap_mc.removeMovieClip();
}
};

View Replies !    View Related
Attaching A Movieclip From The Library To The Stage.
Hey Guys,

Sorry about the noobish question...it's been a while since i've attached something from the library to the stage.

But basically i have my blank document (no movieclips on the stage). I ahve my library item which is a movieclip and i want to attach this directly to the stage NOT into another movieclip.

Any ideas on how to do this??

Thanks in advance guys

View Replies !    View Related
Attaching A Movie From Library After An Event?
Hi all,

my base class loads xml data and then creates the navigation etc in the handler method. In the handler tracing 'this' still returns the base class but can I cannot use this.addChild(something) to add a new MovieClip to the stage. but if I paste the same code in to the constructor or init methods then it works?? it also works if I use this.someMoveClip.addChild(something) just not directly on this? This is really confusing me, code below


Code:
package
{
import flash.display.MovieClip;
import flash.events.Event;

public class Application extends MovieClip
{
public var xmlData:XmlData;

private var _navigation:Navigation;
private var _home:HomePage;

public function Application()
{
trace('New Application');
init();
}

private function init()
{
// load the xml data
xmlData = new XmlData();
xmlData.addEventListener("onLoad", initPages);
xmlData.load('work.xml');
}

private function initPages(e:Event)
{
trace('handleXmlLoaded')


var s:Square = new Square();
s.x = 0;
s.y = 0;
this.addChild(s);


// build navigation
_navigation = new Navigation(this.navigation_mc);
}
}
}

View Replies !    View Related
Attaching ActionScript To MovieClips In The Library
Hello everyone! Here is a question for ya.

In my library I have a bunch of movieclips that are dynamically going to be placed on my stage. Is there a simple method of attaching ActionScript to these movieclips so that when they are used on the stage, they have the script applied to them already?

Thanks in advance!

View Replies !    View Related
Attaching Images From The Library To Stage?
How can I attach images from the library, without converting it to a movieclip, to the stage or empty movieclip. My reason for this is because I have 100+ images in my library and I want to avoid converting them all to individual movieclips for production sake.

Thanks...

View Replies !    View Related
Attaching MCs To A Line/motion Guide..
Hi everyone,

I need to attach a series of mcs to a curved line. These mcs are attached through actionscript with the attachmovie code, they do not tween, just attach at intervals one after another. Its hard to explain i know. When the user presses a button on the screen the first mc appears at the start of the curve, another press attaches another mc perhaps 10px inwards on the line and so on.

Does anyone know any actionscript that will cause these mcs to attach to this motion guide? Or actionscript that will make the mc attach and snap to the curved line??

Thanks, and merry xmas!!

Steven.

View Replies !    View Related
Second Try: Attaching Actions To Shared Library Assets (im)possible?
hi flashlovers and -haters,
would be great if anybody could tell me, if i´m just too stupid or if it just doesn´t work in generell.
my problem is, i try to use buttons from a shared library to which i try to attach actions, but nothing works. even simple things like a on rollover-trace action has no result. behaviors/actions work if the button is in the movié´s library, but if i open the shared library and switch the button symbols then, nothing works anymore.
anybody any clue??
or do shared libraries only work with simple animations.
looking forward for inspiration or salvation

thanks in advance
belikin

View Replies !    View Related
Attaching Movie Clip From Library Problem
I am trying to attach a movie clip to my main movie using a clip from the library that is using "import for runtime sharing".

When I use the attachMovie function, the clip doesn't appear. It only appears if a drag the clip to an area off the stage.

Is there a way around this? Is it possible to replicate the process of draging in a movie in action script?

Thanks

View Replies !    View Related
Help Attaching/adding Movies From Library To Scrollpane
Hi,

I'm a newbie with action script and working in Flash MX,...can anyone please point me in the right direction with adding movies from the library to a scrollpane...

I have a scrollPane (scrollPane1) and a movie (movie1). I just(!) want to be able to dynamically add a number of instances of the movie to the scrollpane.

With the following code, 10 instances of movie1 are added to the stage but they do not appear to be attached, or anything to do with the scrollpane, since it does not scroll to accomodate them.

code:
x = 50;
increaseBy=60;
for (i=1;i<=10;i++){
sq = _root.scrollPane1.attachMovie("movie1","mylabel"+i ,i);
sq._x = x;
sq._y = 30;
x=x+increaseBy;

}


Can anyone see what i'm doing wrong? I have litterally spent many hours over a few days looking through the help file and many examples of similar on this site, but I must be missing something somewhere (yes, a brain, i know what you're thinking lol .

many thanks to anyone who can help.

MRB

View Replies !    View Related
[MX04] Attaching Movie Not In Symbol Library
I'm trying to attach a movie that I created as an emptyMovieClip to a new path (so it loads inside a masked movie clip). The code works fine when I use an object from the symbol library, but I can't get it to take a movie clip I create in the code. How could I do this? Or should I use something other than attachMovieClip?

myPhotoMC = _root["main_"+i]["fullPhotos_"+i]["photo_"+i+"_"+j];
moveClip = _root["main_"+i]["screen_"+i].area.attachMovie(myPhotoMC, "container", 3000);
}

Is there a way to just change the target path of a movie clip instead of going through all this?

Thanks!

View Replies !    View Related
Attaching Library Elements From Main Movie
Hi all,

I did a search on the site but all the example were other way around that I would like to implement, so will ask it straight away.

I have an external.swf movie that I am loading into the main.swf movie. I want to display a movieclip from the main.swf library in the external.swf. Any ideas how this could be achieved?

I have set the linkage Id for the movieclip in the main.swf but I am not able to load it. Obvisouly if I bring the clip into the external.swf it will load nicely. I am using the attachMovie() method.

Thanks

View Replies !    View Related
Attaching A Library Item To The Stage From A Class
First.. I want to make sure I'm following the best practice for what I want to do... I have a flash quiz that uses a class file and then on the last frame I want to attach a custom movieclip with logo graphics, etc on it and the score in it. I heard that best practice is not to have any graphics, etc. in the FLA file and try to keep it all in external class files. I put this movieclip in the library and set up linkage identifiers like so:


Code:
class = logo_mc
base class = flash.display.MovieClip
checked "export for actionscript"
checked "export in first frame"
How do I add this movieclip to the stage?? I see similar posts but people are not adding things to the stage with classes...

I tried a sample document like this:

Code:
package {

import flash.display.Sprite;
import flash.display.MovieClip;
import flash.events.*;

public class testing extends MovieClip {
private var logo_mc:MovieClip;

public function testing(){
loadMovieClips();
}
private function loadMovieClips(){
this.addChild(logo_mc);
}

}
}
But then I get this error:

Code:
TypeError: Error #2007: Parameter child must be non-null.
at flash.display::DisplayObjectContainer/addChild()
at testing/::loadMovieClips()
at testing$iinit()
What am I doing wrong? I'm coming from the actionscript 2 way of thinking where I would have several movie clips in the library that I would attach to the stage with attachMovie when needed.

Any help is much appreciated!

View Replies !    View Related
Dynamically Attaching Library Items From A Loaded Swf
I've been working at this problem for a while so let me cut right to the chase. I have designed a site with a photgallery of lots of high res images.

Okay, so inspired by the Peter Funch site, I knew I wanted a dynamic masking effect, so I use attachmove and attachmask, and pull the images from my library using their linkage identifiers.

Everything is good, but I can't load all of the images up front. The wait would be too big. So what I am doing now is loading a second swf into an empty clip/slug. In that second swf (movie 2) that is in a slug i now attach more movies using movie 2s library.

I just get the feeling that I am doing this very clumsily and in fact after a while things start working less smoothly, even though I am removing clips as I go.

So my questions are these:
1. Is it smart to use a shared library, instead of loading clips onto the root of my movie and having them sit there. Will this prevent my movie from becoming clumsy?
2. Suppose I go to a library item's identifier and export for actionscript. Let's call this movie movie 1. If I have movie 2 and in movie 2 I load movie 1 (loadMove("movie1"...), are movie 1s library items available to movie 2?
3. Does anyone know of a tutorial on loading a movie in stages, and working with linkage property names across these multiple movies.

The site I am trying to improve is http://www.jennifermorton.com

Any strategies would be appreciated.

Thanks,
Kent Rygiel

View Replies !    View Related
Attaching MCs From Library & Placing Them At Pre-determined Positions
I have this piece of code that attaches 3 instances form the mc named 'btn' in the library. I need to place each one of them at specific x/y coordinates and I can't figure out how.


Code:
xbtn0 = 100;
ybtn0 = 100;
xbtn1 = 120;
ybtn1 = 120;
xbtn2 = 130;
ybtn2 = 130;
for (var i = 0; i<3; i++) {
xbtn = ('xbtn'+i);
ybtn = ('ybtn'+i);
trace(xbtn);
trace(ybtn);
_root.attachMovie('btn', 'btn'+i, i, {_x:[xbtn], _y:[ybtn]});
}
Also: There's a dynamic text field inside the 'btn' movie clip; is it possible to have this text field display the mc name? (btn1, btn2, btn3, etc.)

Does anyone know if this is possible at all? Please let me know,

Thanks a lot in advance!
- wryenn

View Replies !    View Related
Attaching Movie Clips From Library With ActionScript
Hello,

I'm trying to target a button within a movie clip that is loaded using ActionScript and I'm having some trouble. Here is my issue: I have two movie clips which reside in the library of my main file called "screenOne_mc" and "screenTwo_mc". Both movie clips contain identical buttons with an instance name of "nextBtn." Both movie clips have linkage identifiers which exactly match their library names. On frame 1 of my main timeline I have the following script:

// attach clip
attachMovie("screenOne_mc", "s1", 0);
swapDepths(0);

// remove ScreenOne_mc and attach ScreenTwo_mc
s1.nextBtn.onRelease = function() {
removeMovieClip("s1");
attachMovie("screenTwo_mc", "S2", 1);
}

// Trace the s2 button clip
this.s2.nextBtn.onRelease = function() {
trace("s2 has been clicked");
}

Attaching screenOne_mc works as does attaching screenTwo_mc, the issue that I'm having that the click of s2.nextBtn doesn't work. I suspect that I'm just incorrectly targeting the the movie clip but I'm just not sure where it is?

Has anyone else run into this issue? Any suggestions?

Thanks!
Jaivin

View Replies !    View Related
Attaching Movie Clips At Runtime From Library
Dear All,

I have 6 different clips in Library with the Linkage class given to following names: Class: mc0, mc1, mc2, mc3, mc4, mc5, mc6,


And I want to attach these clips dynamically at run time using the for loop in AS3.0:


For( var i=0; i<6; i++)
{

What should be the code for this at runtime attachment?

//

}


Regards,
Sridhar B

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