Dynamic Loading

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:

~–~--~–~--~–~--~
[COLOR=orangered]Scene=Scene 1, Layer=action, Frame=1: Line 6: ‘{’ expected
next.onPress = function()

Scene=Scene 1, Layer=action, Frame=1: Line 56: Syntax error.
}[/COLOR]
~–~--~–~--~–~--~

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.

~–~--~–~--~–~--~–~--~–~--~–~
[COLOR=orangered]
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;
}

}
[/COLOR]
~–~--~–~--~–~--~–~--~–~--~–~

Thank you muchly!!! :slight_smile:

i think i figured itout change your script to
[AS]
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;
}
}
}
[/AS]
basiacally in the line
[AS]
_root.onEnterFrame = function() // _root main movie timeline, when movie starts call function
[/AS]

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

hope that helps (-:

: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!