Welcome, Guest
  • Author Topic: once image loaded and resized can't change alpha  (Read 1321 times)

    Algreco

    • Seasoned Programmer
    • ***
    • Posts: 123
    • If it 'aint workin blame Flash!
      • View Profile
      • Line Dezine
      • Email
    I am loading two images dynamically
    I then RESIZE them according to the Stage.width
    I make a crossfading effect between them.
    Doesn't work.
    I get rid of the resizing,
    works.
    I need the resizing.
    I must be missing something, but is there an issue with changing the alpha of resized loaded images?
    :'(

    vesa kortelainen

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 3450
      • View Profile
    Re:once image loaded and resized can't change alpha
    « Reply #1 on: 08/08/04, 05:23 »
    Hey A,

    Can't understand your logic for using Stage.width to resize the image? U load them to movieclips, why not myMovieclip._width & myMovieclip._heigth instead othat Stage.* ?


    Algreco

    • Seasoned Programmer
    • ***
    • Posts: 123
    • If it 'aint workin blame Flash!
      • View Profile
      • Line Dezine
      • Email
    Re:once image loaded and resized can't change alpha
    « Reply #2 on: 08/08/04, 05:45 »
    Hi Vesa,
    The resizing is a different issue. I resize it according to the stage width 'cause later on I stretch the movie clip in the HTML and want my images to keep thier proportions.

    Maybe I should have mentioned that I write commands for resizing the images and playing the movie clip they are in from within a "switch" command.

    But I'm having amazing difficulties with "switch" and "if" commands.
    For example. the devil knows why, but i have the most simple movieclip (not related to the one I wrote about)  and when I try going to it during an "if" case, in relation to a given array and call for a "gotoAndPlay" command, it just doesn't do it!.
    here's the code to make it more clear:

    var Myarray = 1;
    if (Myarray == 1)
    {
    trace ("hi");
    _root.effect1.gotoAndPlay(2);
    }

    trace works. Movie clip doesn't at all!
    same happens when i attach this script to a simple movement movie clip (not that I put a
    "stop();" on the first frame of the movie clip:
    onClipEvent (load){
       var Myarray = 1;
    }
    onClipEvent (enterFrame){
    if (Myarray == 1)
    {
    trace ("hi");
    this.gotoAndPlay(2);
    }
    }
    What's going on with this?
    Sorry for this messy explanation vesa :(

    vesa kortelainen

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 3450
      • View Profile
    Re:once image loaded and resized can't change alpha
    « Reply #3 on: 08/08/04, 06:05 »
    try :
    [script]
    /* first we create function called myFunc (actually u can use almost what name u want for it..) */
    function myFunc() {
    _root.effect1.gotoAndPlay(2);
    }
    /* then we use this ur if-sentence and call myFunc() if Myarray  == 1 */
    var Myarray = 1;
    if (Myarray == 1)
    {
    trace ("hi");
    myFunc();
    }

    [/Script]

    Does that help ? I get back to u later, weather is good here rigth now, im going to enjoy my sunday afternoon :)

    Algreco

    • Seasoned Programmer
    • ***
    • Posts: 123
    • If it 'aint workin blame Flash!
      • View Profile
      • Line Dezine
      • Email
    Re:once image loaded and resized can't change alpha
    « Reply #4 on: 08/08/04, 06:15 »
    Amazingly enough it doesn't!.
    Lets make it real simple.
    We create a square, convert it to a movie clip.

    we edit the movie clip and again change the square nested there to a movie clip and move it with a motion tween after 30 frames 100 pixels in whatever direction.
    we add an action layer and glue a stop(); on the first frame

    we return to the main timeline

    we name the movie clip square
    we paste your code on the first frame of the main timeline:
    function myFunc() {
    _root.square.gotoAndPlay(2);
    }
    /* then we use this ur if-sentence and call myFunc() if Myarray  == 1 */
    var Myarray = 1;
    if (Myarray == 1)
    {
    trace ("hi");
    myFunc();
    }

    We get a hi and nothing moves.

    unbelievable isn't it? ;)
    enjoy the weather.. it's kinda nice here too :)

    Mattias Robo

    • Moderator
    • Systems Administrator
    • *****
    • Posts: 555
      • View Profile
      • nook
    Re:once image loaded and resized can't change alpha
    « Reply #5 on: 08/08/04, 17:43 »

    I thought. "Well Algreco, obviously you've missed something.."
    But when I tried it.. what the heck?!

    Put the function in the first frame. Don work.
    Just say square.gotoAndPlay(2);. Don work.
    onClipEvent(load) { this.gotoAndPLay(2).... Don work.

    If I put a button. WORKS.

    Seems it must be something in the loading procedure.

    Yeah. If u just move the action frame one frame off, it works in every way.


    Quote
    must be missing something, but is there an issue with changing the alpha of resized loaded images?


    No issue. Just carefuly go through your code. :)
    [/size]
         "I've figured it out. It's not the fords... it's what's IN them!.."

    Algreco

    • Seasoned Programmer
    • ***
    • Posts: 123
    • If it 'aint workin blame Flash!
      • View Profile
      • Line Dezine
      • Email
    Re:once image loaded and resized can't change alpha
    « Reply #6 on: 08/08/04, 17:51 »
     :D
    Moving the action frame does indeed work. It feels like the twilight zone to me!.
    What the... is this? why moving the frame makes it work?

    Mattias Robo

    • Moderator
    • Systems Administrator
    • *****
    • Posts: 555
      • View Profile
      • nook
    Re:once image loaded and resized can't change alpha
    « Reply #7 on: 08/08/04, 19:02 »

    I quote myself..

    "Seems it must be something in the loading procedure."

    I.e. the mc might not be entirely loaded before the actions kicks in.
         "I've figured it out. It's not the fords... it's what's IN them!.."

    Algreco

    • Seasoned Programmer
    • ***
    • Posts: 123
    • If it 'aint workin blame Flash!
      • View Profile
      • Line Dezine
      • Email
    Re:once image loaded and resized can't change alpha
    « Reply #8 on: 08/09/04, 03:39 »
    oh ok. so it's not me.... it's flash. wierd