PDA

View Full Version : Dynamic Loading...



rjaini
July 28th, 2003, 12:26 AM
I have this code here... and it seems to work until I try to tell it to listen to the buttons [instances named 'back' and 'next']. And, of course, without the images being able to being viewed... it's just a super fancy way of getting one image to fade in. The error message is:

~--~--~--~--~--~--~
Scene=Scene 1, Layer=action, Frame=1: Line 6: '{' expected
next.onPress = function()

Scene=Scene 1, Layer=action, Frame=1: Line 56: Syntax error.
}
~--~--~--~--~--~--~

Line 56 is the very last line... I've been looking at it too long to figure it out anymore.

Any help would be much appreciated.

~--~--~--~--~--~--~--~--~--~--~--~

square._alpha=0;
i.e. alpha=0
mypic=1;


_root.onEnterFrame = function() // _root main movie timeline, when movie starts call function
next.onPress = function()
{
if (mypic < 10 && !fadeIn && !fadeOut)
{
fadeOut=true;
mypic++;
}
if (mypic >= 10)
{
mypic=1;
}
}

back.onPress = function()
{
if (mypic > 1 && !fadeIn && !fadeOut)
{
fadeOut = true;
mypic--;
}
if (mypic == 1 && !fadeIn && !fadeOut) // if image is on 1 go to the last image in series
{
fadeOut=true;
mypic=10;
}
}
{
if (square._alpha <10)
{
loadMovie("images/image"+mypic+".jpg", "square")
fadeOut=false;
fadeIn=true;
}


if (square._alpha > 10 && fadeOut)
{
square._alpha -= 10;
}


if (square._alpha < 100 && fadeIn && !fadeOut)
{
square._alpha += 10;
}
else
{
fadeIn=false;
}

}

~--~--~--~--~--~--~--~--~--~--~--~

Thank you muchly!!! :)

Mythmon
July 28th, 2003, 12:35 AM
i think i figured itout change your script to

square._alpha=0;
i.e. alpha=0
mypic=1;

_root.onEnterFrame = function() { // _root main movie timeline, when movie starts call function
next.onPress = function()
{
if (mypic < 10 && !fadeIn && !fadeOut)
{
fadeOut=true;
mypic++;
}
if (mypic >= 10)
{
mypic=1;
}
}

back.onPress = function()
{
if (mypic > 1 && !fadeIn && !fadeOut)
{
fadeOut = true;
mypic--;
}
if (mypic == 1 && !fadeIn && !fadeOut) // if image is on 1 go to the last image in series
{
fadeOut=true;
mypic=10;
}
}
{
if (square._alpha <10)
{
loadMovie("images/image"+mypic+".jpg", "square")
fadeOut=false;
fadeIn=true;
}


if (square._alpha > 10 && fadeOut)
{
square._alpha -= 10;
}


if (square._alpha < 100 && fadeIn && !fadeOut)
{
square._alpha += 10;
}
else
{
fadeIn=false;
}
}
}

basiacally in the line

_root.onEnterFrame = function() // _root main movie timeline, when movie starts call function


yoou need a { after function() and at the very end youll need one more }

hope that helps (-:

rjaini
July 28th, 2003, 12:26 PM
:thumb: Tis muchly appreciated.

----------------------------------------

One more question, though... is there anything in there that would make the script not work? There are no more error messages, but the other images never load.

Any [more] help would be great!


Thank you!