Random movie clips

Thanks for reading my post. I have a script that
randomly displays a movie clip of a logo. As shown below:
function showLogo(){
var rndNum:Number = Math.round(Math.random()*11);
this.attachMovie("logo" + rndNum, "logo1_mc",
this.getNextHighestDepth(), {_x:0, _y:0});
setInterval(showLogo(),1000);
It seems to be working. But, I still have two problems.
1. The moviclips stay on the stage after a new clip called.
2. I'd like to have the movieclips fade in then out.
My questions:
1. setInterval() doesn't seem to be called. The online change
in the interval between logos comes from the length of the main
timeline. How do I get it to work?
2. How do I remove a movieclip from the stage? Do I apply it
to the moveclp being shown? Or the moviclip calling the function?
3.How does the _alpha function work?
I'm new to doing this. So, I thank you for your patience in
advance.

If you want alpha fades, you need to tween the alpha values.
One way to do this is with the Tween Class:
http://www.adobe.com/devnet/flash/articles/tweening_05.html
And your code is a little off. Here's the corrected code:

Similar Messages

  • Random Movie Clips loop

    Hey there.
    I have a question about randomizing Movie Clips:
    I am attaching an example where 12 movie clips will be called
    into stage.
    (movieA1, movieA2, movieA3....)
    I am trying to create a situation where instead of triggering
    "movieA1" and so on, the code will trigger:
    movieA1 OR movieB1
    movieA2 OR movieB2
    movieA3 OR movieB3 and so on......
    can anyone help here with how to apply it?
    Thanks!
    note that the attached code triggers AllMovies (MovieA's),
    MovieB's are not in code yet, only in the library, because I am not
    sure how to code such a thing.
    adamlewen

    All I posted was a replacement to the corresponding
    attachMovie portion of your code... as you had in your first post.
    If I've made a correct allowance for the wrapping it should be in
    the 6th line of code beginning with
    var Movie:MovieClip = _root["Movie"+i] =holder.attachMovie
    etc
    What I suggested is only making a change to the first
    parameter to include a
    B or no B in the library ID that's requested by the
    holder.attachMovie part.
    The way its set up (if you use this changed attachMovie) it
    will randomise each time that makeAllMovies is called.
    If I was doing something like this I'd be inclined to set up
    the holder clips once. And then load the randomised content clips
    inside on the setInterval call to something like your makeAllMovies
    function. I also think you'd need to use removeMovieClip for
    previously attached content clips before attaching each time as I
    don't think it just replaces ("overwrites") the old one. I've seen
    other posts where if you attachMovie the same library item with the
    same name in the same holder clip, you end up with 2 instances
    (flash apparently appends a number to one of them each time). If
    this is indeed the situation and happened each time, it would
    probably cause some problems.
    Don't know if that helps. Kglad or others may have more
    insight in this area where I've indicated uncertainty.

  • Selecting a random movie clip from array

    I know this should be easy, but I can't seem to make it work. All I want is for the variable currentPage to select randomly from an array so that every time the page loads, it displays a different currentPage.
    This is what I have so far:
    var myImages:Array = new Array("outsource_mc","solutions_mc","staff_mc");
    var randomImages:Array = [];
    var randomCount:Number = 1;
    var r:Number;
    for (var i = 0; i<randomCount; i++) {
    r = Math.floor(Math.random()*myImages.length);
    randomImages[randomImages.length] = myImages.splice(r, 1);
    trace(randomImages);
    currentPage = the random movie clip;
    Thank-you for any help!!

    Anytime you want to see what something is, use the trace() function... it is an essential code design tool that outputs whatever you ask it to in the Output window....  trace(currentPage);
    For the code I showed currentPage would have been one of the instance name String values from the array.  If you had taken the quotes off of the names in the array, it would be a reference to the actual instance.
    As far as the new code you show, I don't know what you are trying to do, nor what it is not doing that you expect it to, but the last two lines have no relationship to the lines preceding it.

  • Random location for a random movie clip

    I have various movie clips which I need to appear in one of
    four locations randomly. I need the movie clip to also be random. I
    also need more than one movie clip on stage at the same time. I
    believe the following needs to be used:
    Math.random
    duplicateMovieClip
    I also believ that the method needs to be generic. Apart from
    that I am stuck.
    Any help/ideas are appreciated.
    Hope my question makes sense?

    good point. to be honest thinking about it I dont really know
    why
    I have four movie clips, which the user controls called
    user1
    user2
    user3
    user4.
    In addition I have 6 additional movie clips which I need to
    appear and move (randomly) in one of four locations (based on a
    standard stage size):
    locations 1 (start position)
    x co-ordiantes 138.3
    y co-ordiantes 62.8
    locations 2 (start position)
    x co-ordiantes 549.3
    y co-ordiantes 53.8
    locations 3 (start position)
    x co-ordiantes 137.3
    y co-ordiantes 156.8
    locations 4 (start position)
    x co-ordiantes 543.3
    y co-ordiantes 147.8
    locations 1 (finish position)
    x co-ordiantes 291.3
    y co-ordiantes 162.8
    locations 2 (finish position)
    x co-ordiantes 397.3
    y co-ordiantes 162.8
    locations 3 (finish position)
    x co-ordiantes 280.3
    y co-ordiantes 257.8
    locations 4 (finish position)
    x co-ordiantes 400.3
    y co-ordiantes 258.9
    The maximum number of movie clips moving between the two
    positions at once should be 6. Ideally more than one from one
    location
    I would also like the speed at which they move to be
    different.
    The idea is that if a colission occurs between any one of the
    moving movie clips and the avatar(user 1-4) then points are added.
    Hope this helps.
    Thanks
    ******************

  • How to detect  collssion for random or Duplicated movie clips

    Hey guys .. i am back with set of query..till now .. key
    press movement a rocket (mc) is moving left right up down in a
    defined stage area. and i am able to generate some fire balls
    randomize falling from top. this is just i am duplicating the movie
    clip(fireball_mc) .... now i want incase or when the rocket (mc)
    touch the fire ball programm shold detect the collsion and generate
    a score board. well for this i have tried a script for two movie
    clips ... wchich is working but ..i don know or i m not gettng the
    logic how to detect the collission for duplicated movie clips...
    well i m just giving the script for oinly 2 movie clips
    coliding...can any one tell me how to do it with randmize or
    duplkicated mcs??
    for 2 movie clip ...
    _root.mc1.onEnterFrame = function() {
    if(this.hitTest(_root.egg)) {
    _root.result="Oh no..... we are dead";
    } else {
    _root.result="we are going fine";
    (this is happening ..but let me know how can i get the same
    result for ranndom mcs)
    hope someone can help me out ...
    i appriciate ur valuable time to read this..
    thanking you

    Hey thx for ur suggestion...but as i said m very much new to
    actionscript (more designer) so i don have much idea... most of the
    things i m doing for this game i m going through lots of references
    then i tried to understand te codes m implmenting them to my
    need..can u explain me little more about arrays u haves asked for
    loops u asked me to use the hittest function..please /.. i will be
    greatfull to u... thx

  • Movie clip stops playing for no reason

    I am making a banner that has multiple movie clips sharing the same area, creating different rainbow effects when different areas (invisible buttons) are moused over.
    First of all I couldn't figure out if there was a way to have one invisible button over the whole area that changed to a different colored effect with each mouse over (first mouse over the black and whites would change to reds, second would change it to blues, third would change it to browns, etc.). Since I couldn't figure this out I settled on creating three buttons covering a third of the banner each, so when the mouse passes over one button it changes to reds, over another button it changes to blues, over the third it changes to browns.
    The effects are movie clips where each frame has another stripe changing color so it goes in a wave effect from one to the next, and then goes back to white and black in the same manner.  The first frame of each movie clip I had to turn into a nested movie clip so I could turn the alpha to 0, since I was going to have these color effect movie clips on top of one another in the main timeline on different layers, and so you could see the effect even if that color layer wasn't on top. I used the same nested movie clip with zero alpha for the first frame of each color effect clip (reds movie clip, blues movie clip, etc), so I dont' know if that's an issue.
    Anyway, it seemed to work fine for a while, but after working on it for a while longer (and not getting any further since I removed most of the changes I made), now when I test the movie the mouse over does not seem to work correctly. It works fine, seemingly, for the first time I mouse over each button, but in order to have it work again I have to mouse over the button twice, and then it will pause randomly during a part of the clip and I have to move my mouse back over for the movie clip to continue.
    I can't tell if this is because of the overlapping movie clips, or because my buttons are messed up, or if my actionscript is messed up, or if the timeline has to be longer, or what. Currently the timeline is 55 frames, the same as each movie clip.
    I put a movieclip_instance.stop(); command in the first frame of the main timeline, is there a better way to do this? Should I put the stop command in the movie clip itself?
    Here is a section of my AS in the main timeline, this is my first time programming ever, in any language, and trying to learn from the internet is more difficult than I thought it would be.
    redmovie.stop();
    red_btn.addEventListener(MouseEvent.ROLL_OVER, playRed);
    function playRed(event:MouseEvent):void
              redmovie.play();

    I am not sure of what the problem is, so I don't know if this will help or not.  One thing I might suggest is that you use gotoAndPlay(1) instead of play().  That way, if your movieclip is in the middle of playing it won't continue but will start from the beginning.
    You could use one button to have the different movieclips play in sequence if you prefer that.  You would just need to have some form of counter that keeps track of which is the next to play. Somethin like...
    var mcCounter:uint = 0; // start at 0 since an array is being used to identify which movieclip to play
    var mcs:Array = new Array(redmovie, bluemovie, brownmovie);
    only_btn.addEventListener(MouseEvent.ROLL_OVER, playMC);
    function playMC(event:MouseEvent):void
             mcs[mcCounter].play();                  // tell the current mc to play
             mcCounter += 1;                            // increment for the next mc
             if(mcCounter == 3) mcCounter = 0;  // reset the counter if it exceeds the array

  • Unloading a movie clip from a for statement

    Hi,
    I have this code:
    //create empty movie clips to place bin top, flame and bin
    bottom in that order
    this.createEmptyMovieClip("holder_mc2",this.getNextHighestDepth());
    this.createEmptyMovieClip("holder_mc",this.getNextHighestDepth());
    this.createEmptyMovieClip("holder_mc1",this.getNextHighestDepth());
    //attach movie clip/variables
    var dsfInstance:DropShadowFilter = new DropShadowFilter(5,
    45, 0x000000, 1, 10, 10);
    var b:MovieClip =
    holder_mc2.attachMovie("binTop_mc","binTop_mc",holder_mc2.getNextHighestDepth());
    var a:MovieClip =
    holder_mc1.attachMovie("binBottom_mc","binBottom_mc",holder_mc1.getNextHighestDepth());
    //property values
    a._x = 419;
    a._y = 244;
    a._width = 112.0
    a._height = 140.0
    b._x = 419;
    b._y = 175;
    b._width = 112.8;
    b._height = 10.1;
    a.filters = [dsfInstance];
    //create for loop to place the flame particle on the stage
    many times
    for(i=0;i<200;i++){
    //places in temporary movieclip t
    var t:MovieClip =
    holder_mc.attachMovie("flame","flame"+i,holder_mc.getNextHighestDepth());
    // position the movieclip on the stage for y co-ordinates
    t._y = 190;
    t._x = Math.random()*80+(Stage.width/2+115);
    //give the flame random sizes no larger than 80 pixels and no
    smaller than 20
    t._xscale = t._yscale = Math.random()*80 + 20;
    //randomize the frame the movieclip is going to start in the
    flame movie clip is 16 frame long so it will pick number between
    that
    //because math.random produces decimal values we round the
    number using math.ceil to the high whole number
    t.gotoAndPlay(Math.ceil(Math.random()*16));
    what i want to do is remove the movieclip in the for loop off
    the stage when i click on a button. i can manage to remove the
    movie clips with the variables a and b but i cant do it with the
    one in the for loop.
    i put this code in the button:
    on(release){
    play();
    stopAllSounds();
    a.removeMovieClip();
    b.removeMovieClip();
    t.removeMovieClip();
    Is there a way to do this?

    im so dumb! i figured it out.
    i used the "holder_mc" the name of the empty movie clip.
    holder_mc.removeMovieClip();

  • Play internal movie clip at target

    This seems fairly simple, but i can't get it to work.
    I want to play a movieclip from the library when a button is
    clicked. But the LoadMovie is for SWF. The only way I can get it to
    work is have the button click cause - goto frame, which has the
    movie clip. But this gets complicated with various clips. Working
    in Flash 7-8.
    Thank you

    on the last frame of your movieclip attach:
    stop();
    this.dispatchEvent(new Event("finished"));
    right click your movieclip in the library, click linkage, tick export for actionscript and assign a class (eg, Starmove).
    you can then use:
    var minTime:uint = 1000;
    var maxTime:uint = 3000;
    var timer:Timer=new Timer(timeF(),0);
    timer.addEventListener(TimerEvent.TIMER,starF);
    timer.start();
    function starF(e:TimerEvent){
    var star:Starmove=new Starmove();
    addChild(star);
    star.x = Math.floor(Math.random()(stage.stageWidth-star.width));  // these two will probably need adjustment
    star.y = Math.floor(Math.random()(stage.stageHeight-star.height)); // ditto
    star.addEventListener("finished",removeStarF);
    timer.delay = timeF();
    function removeStarF(e:Event){
    removeChild(e.currentTarget);
    e.currentTarget.removeEventListener("finished",removeStarF);
    e.currentTarget=null;
    function timeF():uint{
    return minTime+Math.floor(Math.random()*(maxTime-minTime));

  • Removing movie clips in arrays

    Hi there
    I have this code in my Flash file:
    for(bubble in bubbleArray){
         bubbleArray[bubble]._y -= 3;
         if(bubbleArray[bubble]._y < 370){
              bubbleArray[bubble].removeMovieClip();
    I'm wondering, when I remove the movie clips should I also be popping them from the array?
    I have an onEnterFrame function that attaches the movie clips and pushes them into the array, so I'm worried that if I don't pop them the array will continue to increase in size and slow down the movie. Is this the case, or will they be automatically removed from the array by the removeMovieClip() method above?

    Looks like I spoke too soon. I imagined that removing them from the array would be easy, but I'm struggling.
    The movie clip that is removed from its parent clip and should be removed from the array will not always be the first element in the array, and I'll need to remove multiple clips at a time. I've put in a trace action to trace the length of my array, and after about ten seconds it contains about 2500 elements, most of which have already been removed using the removeMovieClip() method. I'm worried this will slow down the movie.
    So to clarify: How can I remove these elements from my array when I remove them from the stage?
    I tried to include something like:
    while(bubbleArray[0] == undefined){
         bubbleArray.shift();
    but it caused Flash Player to freeze up. Also, if I trace bubbleArray[0] it is only "undefined" before something is pushed into the array. Once the clip has been removed from the stage, the trace just returns a blank line, not "undefined".
    I'd appreciate any help.
    Here is all my code:
    stop();
    splash.stop();
    var i:Number;
    var j:Number = 0;
    var minBubbles:Number = 10;
    var maxBubbles:Number = 20;
    var bottomBubbleLimit:Number = 0;
    var topBubbleLimit:Number = 1;
    var bubbleNumber:Number;
    var bubbleX:Number;
    var bubbleY:Number;
    var bubbleScale:Number;
    var bubbleMinScale:Number = 30;
    var bubbleMaxScale:Number = 100;
    var fewerBubbles:Number;
    var ring:String;
    var ringArray:Array = [ringAnimation.ring1, ringAnimation.ring2];
    var bubbleArray:Array = [];
    ringAnimation.onEnterFrame = function(){
        for(ring in ringArray){
            if(ringArray[ring]._y > 370){
                bubbleNumber = (minBubbles + (Math.random() * (maxBubbles - minBubbles)));
                for(i = 0; i < bubbleNumber; i++){
                    bubbleX = ((ringArray[ring]._x - (ringArray[ring]._width / 2)) + (Math.random() * ringArray[ring]._width));
                    bubbleY = ((ringArray[ring]._y - (ringArray[ring]._height / 2)) + (Math.random() * ringArray[ring]._height));
                    bubbleScale = bubbleMinScale + (Math.random() * (bubbleMaxScale - bubbleMinScale));
                    ringAnimation.attachMovie("bubble", "bubble" + String(j), this.getNextHighestDepth(), {_x:bubbleX, _y:bubbleY, _xscale:bubbleScale, _yscale:bubbleScale});
                    bubbleArray.push(ringAnimation["bubble" + String(j)]);
                    j++;
        for(bubble in bubbleArray){
            bubbleArray[bubble]._y -= 3;
            if(bubbleArray[bubble]._y < 370){
                bubbleArray[bubble].removeMovieClip();
        trace(bubbleArray.length);
        if(ringAnimation._currentFrame == 6){
            splash.gotoAndPlay(1);
        }else if(ringAnimation._currentFrame == 12){
            splash.gotoAndPlay(1);
    fewerBubbles = setInterval(reduceBubbles, 600);
    function reduceBubbles(){
        if(minBubbles > bottomBubbleLimit){
            minBubbles--;
        if(maxBubbles > topBubbleLimit){
            maxBubbles--;
        if(minBubbles == bottomBubbleLimit && maxBubbles == topBubbleLimit){
            clearInterval(fewerBubbles);

  • Attach movie clips using seperate functions

    I'm having a little trouble with the following code. I'm
    calling two functions: init() and inittwo() to attach some movie
    clips to the stage. If I comment one of them out, the other works
    fine and the movement is okay. But as it is, only the "cloud" movie
    clips are being attached. I need for the clips in the "dreamarray"
    to be attached, and then for the "clouds" to be attached with a
    second function. I'm probably not going about this the right way,
    but I could sure use some help!
    It would also be cool if I could attach the dreams at set "x"
    values instead of random distribution. I'm not sure how to set a
    seperate x value for each item in the array being attached.
    var numClouds:Number = 10;
    var fl:Number = 250;
    var gravity:Number = .5;
    var vx:Number = 0;
    var vy:Number = 0;
    var vz:Number = 0;
    var friction:Number = .97;
    var vpX:Number = Stage.width / 2;
    var vpY:Number = Stage.height / 2;
    var vpY:Number = 400;
    var dreamarray:Array = new Array();
    dreamarray[0] = "dreamone";
    dreamarray[1] = "dreamtwo";
    dreamarray[2] = "dreamthree";
    init();
    inittwo();
    function init() {
    for (var i:Number = 0; i<dreamarray.length; i++) {
    var dream:MovieClip = attachMovie(dreamarray
    , "dreamarray" + i, i);
    //var dream:MovieClip = attachMovie("dreamone", "dreamone" +
    i, i);
    dream.x = Math.random() * 1600 - 800;
    dream.y = 50;
    dream.z = Math.random() * 800;
    //trace("functioncall");
    //tree.x = Math.random() * 2000 - 1000;
    //tree.y = 50;
    //tree.z = Math.random() * 10000;
    function inittwo() {
    for (var j:Number = 0; j<numClouds; j++) {
    var cloud:MovieClip = attachMovie("cloud", "cloud" + j, j);
    //tree.x = 400;
    cloud.x = Math.random() * 1600 - 800;
    cloud.y = 50;
    cloud.z = Math.random() * 800;
    function onEnterFrame():Void {
    if(Key.isDown(Key.UP))
    vz -= 1;
    else if(Key.isDown(Key.DOWN))
    vz += 1;
    if(Key.isDown(Key.LEFT))
    vx += 1;
    else if(Key.isDown(Key.RIGHT))
    vx -= 1;
    if(Key.isDown(Key.SPACE))
    vy += 1;
    vy -= gravity;
    vx *= friction;
    vy *= friction;
    vz *= friction;
    for (var i:Number=0;i<dreamarray.length;i++) {
    //i think there is a error here
    var dream:MovieClip = this["dreamarray" +i];
    dream.x += vx;
    dream.y += vy;
    dream.z += vz;
    if(dream.y < 200)
    dream.y = 200;
    vy = 0;
    if (dream.z <= -fl) {
    dream.z += 1000;
    else if(dream.z > 1000 - fl)
    dream.z -= 1000;
    var scale:Number = fl / (fl + dream.z);
    dream._xscale = dream._yscale = scale*100;
    dream._x = vpX + dream.x * scale/2;
    dream._y = vpY + dream.y * scale/2;
    //dream._x = dream.x * scale/2;
    dream._alpha = scale * 60 + 40;
    dream.swapDepths(-dream.z);
    for (var j:Number=0;j<numClouds;j++) {
    var cloud:MovieClip = this["cloud" + j];
    cloud.x += vx;
    cloud.y += vy;
    cloud.z += vz;
    if(cloud.y < 50)
    cloud.y = 50;
    vy = 0;
    if (cloud.z <= -fl) {
    cloud.z += 500;
    else if(cloud.z > 10000 - fl)
    cloud.z -= 10000;
    var scale:Number = fl / (fl + cloud.z);
    cloud._xscale = cloud._yscale=scale*200;
    cloud._x = vpX + cloud.x * scale;
    cloud._y = vpY + cloud.y * scale;
    cloud._alpha = scale * 60 + 40;
    cloud.swapDepths(-cloud.z);

    Hi Ive just taken a very quick look at your code and Ive
    noticed at least one or two mistakes.
    you are calling:
    init();
    inittwo();
    before the actual functions have been declared.
    Flash works from top to bottom when actioning code so by
    calling:
    init();
    inittwo();
    bofore the function has been declared and this will do
    nothing as it cannot find the functions to call as they have been
    declared AFTER the function calls.
    The best thing to do is put any calls right at the bottom and
    then you will know everything is ready to be triggered.

  • Help! Remove Movie Clips

    OK...here's my problem... I am making a portfolio site and I
    have my thumbnails being created dynamically through XML...very
    similar to the galleries example in the Sample and Tutorials. Only
    problem is that I have multiple keyframes with different thumbnails
    that need to be displyed through a different XML file. I got it to
    work but the thumbnails from the first frame are still showing on
    the second frame...How do I remove the dynamically created movie
    clips?

    OK...here's the code...At thebottom of the document, I need
    to remove the clips created on the next button. This is the same
    code from the gallery sample file; I just added my own XML file.
    stop();
    import mx.transitions.*;
    _global.thisX = 30;
    _global.thisY = 70;
    _global.stageWidth = 600;
    _global.stageHeight = 400;
    var gallery_xml:XML = new XML();
    gallery_xml.ignoreWhite = true;
    gallery_xml.onLoad = function(success:Boolean) {
    try {
    if (success) {
    var images:Array = this.firstChild.childNodes;
    var gallery_array:Array = new Array();
    for (var i = 0; i<images.length; i++) {
    gallery_array.push({src:images
    .firstChild.nodeValue});
    displayGallery(gallery_array);
    } else {
    throw new Error("Unable to parse XML");
    } catch (e_err:Error) {
    trace(e_err.message);
    } finally {
    delete this;
    gallery_xml.load("gallery_practices2.xml");
    function displayGallery(gallery_array:Array) {
    var galleryLength:Number = gallery_array.length;
    for (var i = 0; i<galleryLength; i++) {
    var thisMC:MovieClip =
    this.createEmptyMovieClip("image"+i+"_mc", i);
    mcLoader_mcl.loadClip(gallery_array.src, thisMC);
    preloaderMC = this.attachMovie("preloader_mc",
    "preloader"+i+"_mc", 5000+i);
    preloaderMC.bar_mc._xscale = 0;
    preloaderMC.progress_txt.text = "0%";
    thisMC._x = _global.thisX;
    thisMC._y = _global.thisY;
    preloaderMC._x = _global.thisX;
    preloaderMC._y = _global.thisY+20;
    if ((i+1)%5 == 0) {
    _global.thisX = 20;
    _global.thisY += 80;
    } else {
    _global.thisX += 80+20;
    var mcLoader_mcl:MovieClipLoader = new MovieClipLoader();
    var mclListener:Object = new Object();
    mclListener.onLoadStart = function() {
    mclListener.onLoadProgress = function(target_mc, loadedBytes,
    totalBytes) {
    var pctLoaded:Number =
    Math.round(loadedBytes/totalBytes*100);
    var preloaderMC =
    target_mc._parent["preloader"+target_mc.getDepth()+"_mc"];
    preloaderMC.bar_mc._xscale = pctLoaded;
    preloaderMC.progress_txt.text = pctLoaded+"%";
    mclListener.onLoadInit = function(evt:MovieClip) {
    evt._parent["preloader"+evt.getDepth()+"_mc"].removeMovieClip();
    var thisWidth:Number = evt._width;
    var thisHeight:Number = evt._height;
    var borderWidth:Number = 2;
    var marginWidth:Number = 8;
    evt.scale = 8;
    evt.lineStyle(borderWidth, 0x000000, 100);
    evt.beginFill(0xFFFFFF, 100);
    evt.moveTo(-borderWidth-marginWidth,
    -borderWidth-marginWidth);
    evt.lineTo(thisWidth+borderWidth+marginWidth,
    -borderWidth-marginWidth);
    evt.lineTo(thisWidth+borderWidth+marginWidth,
    thisHeight+borderWidth+marginWidth);
    evt.lineTo(-borderWidth-marginWidth,
    thisHeight+borderWidth+marginWidth);
    evt.lineTo(-borderWidth-marginWidth,
    -borderWidth-marginWidth);
    evt.endFill();
    evt._xscale = evt.scale;
    evt._yscale = evt.scale;
    evt._rotation = Math.round(Math.random()*-10)+5;
    evt.onPress = function() {
    this.startDrag();
    this._xscale = 30;
    this._yscale = 30;
    this.origX = this._x;
    this.origY = this._y;
    this.origDepth = this.getDepth();
    this.swapDepths(this._parent.getNextHighestDepth());
    this._x = (_global.stageWidth-evt._width+30)/2;
    this._y = (_global.stageHeight-evt._height+30)/2;
    mx.transitions.TransitionManager.start(this,
    {type:mx.transitions.Photo, direction:0, duration:1,
    easing:mx.transitions.easing.Strong.easeOut, param1:empty,
    param2:empty});
    evt.onRelease = function() {
    this.stopDrag();
    this._xscale = this.scale;
    this._yscale = this.scale;
    this._x = this.origX;
    this._y = this.origY;
    evt.onReleaseOutside = evt.onRelease;
    mcLoader_mcl.addListener(mclListener);
    next_btn.onRelease= function() {
    gotoAndStop(2);
    back_btn.onRelease= function() {
    gotoAndStop(1);
    }

  • Self-spawning Movie Clips Don't Run AS2

    Hello,
    I have made a preloader, and to make the bar appear earlier during the loading process, I made every movie clip except the preloader files have "Export in first frame unchecked." Since I did this, my game doesn't run the movie clips anymore. I had enemy units come across the screen randomly, and now nothing appears at all. What will solve this? If you need the .FLA or a screenshot, please let me know.
    MrA615.

    The movie clips still aren't starting at frame 3.
    Here is a screenshot. Am I doing it right? Whoops, when I said Layer, I meant Frame.
    Message was edited by: MrA615

  • Center movie clips dynamically, as3.0

    Hi.  I have seen this discussed both on Adobe Forums and other sites but I can't seem to make sense of the code supplied by what I have seen thus far.
    I am trying to center display objects that are added to the stage at runtime dynamically through a basic drawing application.
    the code is something like this:
    1. add an event listener for the drawing event.
    2. add the path you want to draw to a container movie clip on the stage.
    3. add an enter-frame event listener to change the scale of the path randomly .... and this is the moment i want to change the default top,left registration point to the center,center of the path.  each path has its own registration point as i can tell thus far but at this point the scale is happening from the top,left of the container rather than about the path's own self.  and if it were to happen about the path i would have to get the bounds of the path and do some averaging to center the registration point.
    unfortunately i don't know what the code looks like to achieve what i'm trying to get.
    any help is appreciated.  thanks in advance.

    Well if using the graphics.lineTo method is Bitmap data then that is what I'm using.  But each call to the shape that I'm drawing is a new Shape(); .  The second paragraph you wrote seems a bit daunting when viewing it in the abstract sense.  Your first reply was a bit more concrete but I guess the first response didn't account for everything being in one container.  Should I create a container2 Movie Clip and create that as a new box on a per-shape basis so that I have multiple container2 mc's in the following path:
    container.container2[i].shape[i] where i would be an index (such that i++) though the code wouldn't be written exactly that way. ?
    (To store localX,Y positions in an array or vector shouldn't be too hard but I would need to try it several times before I get it right).

  • Selecting a movie clip to play

    Ok,
    The following set of code is partially working for me. If the
    randomNumber*100 is < 90, the clip "straight" plays just fine.
    If it is >90, both the "slightbenddown", and "slightbendup"
    clips go off at the same time.
    var randomNumber:Number = Math.random();
    if (randomNumber*100 <= 90)
    straight.play()
    if (randomNumber*100 > 90 && randomNumber*100
    <= 91)
    slightbenddown.play()
    if (randomNumber*100 > 91 && randomNumber*100
    <= 92)
    slightbendup.play()
    How can I make it so that "slightbenddown" only plays when
    (90<randomNumber<=91) and "slightbendup only plays when
    (91<randomNumber<=92)?
    Thank you for any help that you can give.
    BobR

    I tried the attached code, and still did not get what I was
    looking for. If the else is included for all of the iterations, I
    only get to see straight and slightbenddown. If I do the same
    thing, except leave off all of the elses, I do get to see the other
    movie clips, but almost always I see more than one at a time
    (usually slightbenddown + any other one).
    Any ideas would be appreciated.
    BobR

  • Creating functions for movie-clips(serious problem)

    Hello,
    This is I think my third thread on these forums and in my
    previous threads I had always got some help.Well, now I have
    another serious problem, can you help me?
    I am unable to create a function that can control movie
    clips. Let me explain:-
    I have 10 movie clips on the stage and I have assigned them
    that whenever they crash to an object, they will go to a random
    position. Writing this code ten times for each movie clip would be
    very tedious, so, I thought about creating a function, but, it
    doesn't work. Here's the function, can you correct it?
    var object:movieClip;
    function position(object) {
    var testnum1:Number;
    testnum1 = random(290)+36;
    _root.object._y = -77.6;
    _root.object._x = testnum1;
    position(nameofmovieclip)
    PLEASE HELP IS REQUIRED!!!!
    Thanking All,
    Chinmaya

    Thanks for the reply,
    I tried that, it worked!
    But, now, I am encountering a really odd problem. This time
    I'll give you my full code.The problem is, that now when the object
    collides with another one, it changes its position according to the
    code but then after a while, it just passes through the object.
    Here's my code:-
    function position(object) {
    var testnum1:Number;
    testnum1 = random(290)+36;
    object._y = -77.6;
    object._x = testnum1;
    metal.onEnterFrame = function() {
    _root.metal._y += speednum;
    if (_root.metal.hitTest(_root.testline)) {
    position(_root.metal);
    speednum = random(6)+1;
    Can you help me out again,
    Thanks,
    Chinmaya
    P.S. I have tried to use the function like this:
    position(metal), but it doesn't work. And yes, I have already
    defines speednum somewhere before, so that isn't the
    problem.

Maybe you are looking for

  • IPOD TOUCH can't be undisabled due to having a passcode!!

    I had been away for awhile and just got home. My IPOD touch had been disabled and when I turn it on it says "IPOD IS DISABLED: connect to ITUNES". Well, I connect to Itunes on my windows XP and the ITUNES says "ITUNES could not connect to the IPOD "x

  • IMac Display as Monitor for PC

    I have an iMac 2.66 GHz Intel Core 2 Duo, 2 GB RAM, OS X 10.6.2 and an old Dell Pentium III 933 MHz which I would love to somehow connect together. I am considering to install Linux on my Dell and use both computers for different reasons. I wonder if

  • My iPad air touchscreen is non responsive. What do I do?

    My iPad air touchscreen is not responsive. I tried rebooting with no success.

  • Unable to sync files to creative cloud

    I cant sync my files to creative cloud from my mac. It says syncronising is turned of, but i havent turned any thing of ?

  • Deleting one

    I am trying to delete one folder from the 19 I published. I made the mistake of deleting the name of that folder from the site organizer. So now the name isn't there and doesn't show up in the site organizer, but DOES show in the up to date published