Professional Web Applications Themes

createEmptyMovieClip on bottom layer? - Macromedia Flash Actionscript

I've got a fla with several layers containing my menu, header, content, etc. On the bottom layer I've got some code that creates an empty MC, loads a random jpg, and fades it in. The problem is that the jpg loads on top of everything else, even though it is on the bottom layer and I have the layer specified to 1. Heres the code with the problem: // Create empty MC and load random jpgs createEmptyMovieClip("bg", 1); bg._alpha = 0; bg.loadMovie("bgpicts/bg"+Math.ceil(Math.random()*9)+".jpg", "bg", 1); And heres the rest of the code if you want to know: // Checks to see ...

  1. #1

    Default createEmptyMovieClip on bottom layer?

    I've got a fla with several layers containing my menu, header, content, etc. On the bottom layer I've got some code that creates an empty MC, loads a random jpg, and fades it in.

    The problem is that the jpg loads on top of everything else, even though it is on the bottom layer and I have the layer specified to 1.

    Heres the code with the problem:

    // Create empty MC and load random jpgs
    createEmptyMovieClip("bg", 1);
    bg._alpha = 0;
    bg.loadMovie("bgpicts/bg"+Math.ceil(Math.random()*9)+".jpg", "bg", 1);

    And heres the rest of the code if you want to know:

    // Checks to see if image is loaded and tells flash its there
    this.onEnterFrame = function() {
    BLoaded = bg.getBytesLoaded();
    BTotal = bg.getBytesTotal();
    percent = BLoaded/BTotal*100;
    //Transforms jpg
    if ((BLoaded == BTotal) && BLoaded>0) {
    bg._xscale = 100;
    bg._width = 750;
    bg._height = 500;
    bg._x = 0;
    bg._y = 0;
    //alpha fade in
    this.onEnterFrame = function() {
    _root.bg._alpha += 10;
    if (_root.bg._alpha>=100) {
    delete this.onEnterFrame;
    }
    };
    }
    };



    Let me know if you want the fla

    Thanks for your help,

    Gabe



    gabetiller webforumsuser@macromedia.com Guest

  2. #2

    Default Re:createEmptyMovieClip on bottom layer?

    the layer containing your code is irrelevent. you bg is created at depth 1. as such it will appear above everything that you manually place on-stage because these objects usually have depth less than -16,000. to remedy, use swapDepths() to position your movieclip bg.


    kglad webforumsuser@macromedia.com Guest

  3. #3

    Default Re:createEmptyMovieClip on bottom layer?

    Thanks much, turns out I dont even need swapDepths(), I just needed to know that the other elements were way down there at -16000 and then I created the MC at -99999.

    // Create empty MC, send to bottom, and load random jpgs
    createEmptyMovieClip("bg", -99999);
    bg._alpha = 0;
    bg.loadMovie("bgpicts/bg"+Math.ceil(Math.random()*9)+".jpg", "bg", -99999);


    Anywho, thanks for your help,

    Gabe


    gabetiller webforumsuser@macromedia.com Guest

  4. #4

    Default Re:createEmptyMovieClip on bottom layer?

    you're welcome.


    kglad webforumsuser@macromedia.com Guest

Similar Threads

  1. createEmptyMovieClip & functions
    By enn in forum Macromedia Flash
    Replies: 1
    Last Post: December 3rd, 01:00 AM
  2. Bottom layer spoils its upprt layer
    By jae kim in forum Adobe Photoshop 7, CS, CS2 & CS3
    Replies: 6
    Last Post: August 14th, 01:46 AM
  3. Bottom layer spoils its upper layer
    By jae kim in forum Adobe Photoshop 7, CS, CS2 & CS3
    Replies: 2
    Last Post: August 13th, 06:15 AM
  4. on Director : 3D layer + flash (SWF) layer (or with other layer type)
    By onelsonic webforumsuser@macromedia.com in forum Macromedia Director 3D
    Replies: 1
    Last Post: July 16th, 01:20 PM
  5. How to position a "footer" layer at the bottom of each page
    By Michael in forum Macromedia Dreamweaver
    Replies: 4
    Last Post: July 16th, 11:53 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139