Problems using dynamically created clip with loaded jpg...

  • posidan
  • Newbie
  • Newbie
  • posidan
  • Posts: 11

Post 3+ Months Ago

Hi everyone.

Im currently working on a project that requires me to modify a page flip effect script. I want it to become dynamic, meaning loading jpg into the pages instead of creating frames for each page in the flash.

I can load my images really easily, but im stuck with a problem, everytime i recreate my pages there is a flicker since my jpg reloads (its fast since its cached, but its still very annoying).

Ok, so heres the first draft i did, which effectively loads the jpgs but reloads each time a page is flipped:

Code: [ Select ]
// Place the Flipping Pages
function setFlipping() {
    var targ;
    // Place the "F"lipping "T"op "P"age
createEmptyMovieClip("FTPage", 3);
    // Creates a white rectangle for the page
    makePage (FTPage, dir);
    FTPage.attachMovie("generic_page", "Print", 1);
    FTPage.Print.loadMovie('pages/medium/1.jpg');

    with (FTPage.Print) {
        _x = (dir*pageWi/2);
        _y = -pivotY;
    }
    
    FTPage.createEmptyMovieClip("Shade", 2);
    makeShade(FTPage.Shade, dir);

    // Place the "F"lipping "B"ottom "P"age
createEmptyMovieClip("FBPage", 4);
    // Creates a white rectangle for the page
    makePage (FBPage, -dir);
    FBPage.attachMovie("generic_page", "Print", 1);
    FBPage.Print.loadMovie('pages/medium/2.jpg');

    with (FBPage.Print) {
        _x = -dir*pageWi/2;
        _y = -pivotY;
    }
    FBPage._rotation = dir*90;
}
  1. // Place the Flipping Pages
  2. function setFlipping() {
  3.     var targ;
  4.     // Place the "F"lipping "T"op "P"age
  5. createEmptyMovieClip("FTPage", 3);
  6.     // Creates a white rectangle for the page
  7.     makePage (FTPage, dir);
  8.     FTPage.attachMovie("generic_page", "Print", 1);
  9.     FTPage.Print.loadMovie('pages/medium/1.jpg');
  10.     with (FTPage.Print) {
  11.         _x = (dir*pageWi/2);
  12.         _y = -pivotY;
  13.     }
  14.     
  15.     FTPage.createEmptyMovieClip("Shade", 2);
  16.     makeShade(FTPage.Shade, dir);
  17.     // Place the "F"lipping "B"ottom "P"age
  18. createEmptyMovieClip("FBPage", 4);
  19.     // Creates a white rectangle for the page
  20.     makePage (FBPage, -dir);
  21.     FBPage.attachMovie("generic_page", "Print", 1);
  22.     FBPage.Print.loadMovie('pages/medium/2.jpg');
  23.     with (FBPage.Print) {
  24.         _x = -dir*pageWi/2;
  25.         _y = -pivotY;
  26.     }
  27.     FBPage._rotation = dir*90;
  28. }


Ok so this works. Now to remove the flicker, i thought, why not create all clips at the beginning, and then just replace Print by the current page movieclip? So i tried this :

In a frame on the main timeline (i did only two for test purposes):

Code: [ Select ]
createEmptyMovieClip("print1", 3);
print1.loadMovie("pages/medium/1.jpg");
createEmptyMovieClip("print2", 110);
print2.loadMovie("pages/medium/2.jpg");
  1. createEmptyMovieClip("print1", 3);
  2. print1.loadMovie("pages/medium/1.jpg");
  3. createEmptyMovieClip("print2", 110);
  4. print2.loadMovie("pages/medium/2.jpg");


Then in the flipping page function:
Code: [ Select ]
// Place the Flipping Pages
function setFlipping() {
    var targ;
    // Place the "F"lipping "T"op "P"age
createEmptyMovieClip("FTPage", 3);
    makePage (FTPage, dir);
    FTPage.attachMovie("generic_page", "Print", 1);
    FTPage.Print = _level0.print1;

    with (FTPage.Print) {
        _x = (dir*pageWi/2);
        _y = -pivotY;
    }
    FTPage.createEmptyMovieClip("Shade", 2);
    makeShade(FTPage.Shade, dir);

    // Place the "F"lipping "B"ottom "P"age
createEmptyMovieClip("FBPage", 4);
    makePage (FBPage, -dir);
    FBPage.attachMovie("generic_page", "Print", 1);
    FBPage.Print = _level0.print2;

    with (FBPage.Print) {
        _x = -dir*pageWi/2;
        _y = -pivotY;
    }
    FBPage._rotation = dir*90;
}
  1. // Place the Flipping Pages
  2. function setFlipping() {
  3.     var targ;
  4.     // Place the "F"lipping "T"op "P"age
  5. createEmptyMovieClip("FTPage", 3);
  6.     makePage (FTPage, dir);
  7.     FTPage.attachMovie("generic_page", "Print", 1);
  8.     FTPage.Print = _level0.print1;
  9.     with (FTPage.Print) {
  10.         _x = (dir*pageWi/2);
  11.         _y = -pivotY;
  12.     }
  13.     FTPage.createEmptyMovieClip("Shade", 2);
  14.     makeShade(FTPage.Shade, dir);
  15.     // Place the "F"lipping "B"ottom "P"age
  16. createEmptyMovieClip("FBPage", 4);
  17.     makePage (FBPage, -dir);
  18.     FBPage.attachMovie("generic_page", "Print", 1);
  19.     FBPage.Print = _level0.print2;
  20.     with (FBPage.Print) {
  21.         _x = -dir*pageWi/2;
  22.         _y = -pivotY;
  23.     }
  24.     FBPage._rotation = dir*90;
  25. }


I thought this would move the print1 and print2 movieclip and replace the Print ones, without reloading any jpg, but it does not.

Heres what it does... Instead of going at the same place that loaded jpg would go (as in the first example), the _x and _y property of the ones in the second example seems to base themselves on some other coordinates (i mean both are set to the same values but the clips ends up not at the same place). And also, the rotation on the second mc doesnt occur at all.

So in summary what i dont understand is the difference in doing this

FTPage.attachMovie("generic_page", "Print", 1);
FTPage.Print.loadMovie('pages/medium/1.jpg');

and this

FTPage.attachMovie("generic_page", "Print", 1);
FTPage.Print = _level0.print1;

(_level0.print1 being dynamically created on the main timeline). Why cant i use the same positionning scheme in the second example?

Thanks for any help (if you can understand anything i asked hahaha, i know its not that clear!) :D
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

Post Information

  • Total Posts in this topic: 1 post
  • Users browsing this forum: No registered users and 12 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.