I have been trying to build this application for a number of weeks now and have run into something that simply stumps me.
I have a photo gallery that loads photos, an mp3 and (eventually) a txt file that will have captions, photo credits and transition times.
Now when the first two pics load and transition, they have these weird white boxes covering the photos. When the transition between the photos is done, the white box goes away.
i have no idea where these shapes are coming from. The mp3 is not set to stream, I can interchange the photos and the problem persists, I have tried changing the depths.
THEY ARE GHOSTS IN THE MACHINE and are slowly driving me mad.
"I really must get a thinner pencil. I ca'n't manage this one a bit: it writes all manner of things that I don't intend". // Alice, Through the Looking Glass
Oddly enough, I can't seem to download the .zip, it just opens up a browser page full of encryption . . . is that a problem on my end? hmmm could you email the .zip to me?
"I really must get a thinner pencil. I ca'n't manage this one a bit: it writes all manner of things that I don't intend". // Alice, Through the Looking Glass
"I really must get a thinner pencil. I ca'n't manage this one a bit: it writes all manner of things that I don't intend". // Alice, Through the Looking Glass
Never mind, I see it now. It's the traces you have, and it executes over and over. That means, to answer your last question, it is iterating.
I get this output:
Code:
making picboxes
making picboxes
making picboxes
making picboxes
making picboxes
making picboxes
making picboxes
making picboxes
making picboxes
making picboxes
making picboxes
making picboxes
making picboxes
onload event for mc
firstTransition= 0
secondTransition= 9.8
on enter for mc
firstTransition= 0
secondTransition= 9.8
on enter for mc
firstTransition= 0
secondTransition= 9.8
on enter for mc
firstTransition= 0
secondTransition= 9.8
on enter for mc
firstTransition= 0
secondTransition= 9.8
on enter for mc
firstTransition= 0
secondTransition= 9.8
on enter for mc
firstTransition= 0
secondTransition= 9.8
etc...
Oh, if you use actionscript highlighting when you post code, your code is much easier to read.
"I really must get a thinner pencil. I ca'n't manage this one a bit: it writes all manner of things that I don't intend". // Alice, Through the Looking Glass
that is what is confusing me. The transition check will iterate but the alpha transitions don't.
Do you see white boxes on the first two images?
Is the image shown at 5% opacity with no transitioning?
Am I seeing what everyone else is seeing.
I have been working on both a PC and Mac. Weird stuff.
code:
onClipEvent (load) {
//trans is a variable to keep track of what transition is next
_global.trans = 1;
}
onClipEvent (enterFrame) {
this.onEnterFrame = function() {
//takes transition info from main timeline
firstTransition = _root["pictrans"+trans];
secondTransition = _root["pictrans"+(trans+1)]-.2;
//trace("firstTransition= "+firstTransition);
//trace("secondTransition= "+secondTransition);
// Text Boxes show progress of Sound Object
if (stopped != true) {
_root.myDurationText = mySound.duration/1000;
_root.myPositionText = mySound.position/1000;
// checks to see if playhead of sound object is at the transition
if (mySound.position/1000>firstTransition && mySound.position/1000<=secondTransition) {
trace("HEY! "+_root["pic"+trans]._alpha);
_root["pic"+(trans-1)].caption.removeTextField();
// makes images transition
if (_root["pic"+trans]._alpha<=100) {
_root["pic"+trans]._alpha += 5;
_root["pic"+(trans-1)]._alpha -= 5;
} else {
//makes caption visible after new image is at 100%
_root["pic"+trans].caption._visible = true;
//remove image that has alpha of 0
_root["pic"+(trans-1)].removeMovieClip();
}
trace("successfully changed trans");
_global.trans++;
}
}
};
}
"I really must get a thinner pencil. I ca'n't manage this one a bit: it writes all manner of things that I don't intend". // Alice, Through the Looking Glass
Okay, explain your .fla to me, I'll the buttons and stuff, what they're supposed to do, etc. (I'm finally getting some time to sit down and take a close look at it)
"I really must get a thinner pencil. I ca'n't manage this one a bit: it writes all manner of things that I don't intend". // Alice, Through the Looking Glass
the included file (twelve_6) has comment tags for virtually EVERY line. (like I said, this is driving me nuts)
the one caveat is that you need to wait for the Duration text box to display a number before you press the "test" button when you play the swf. The sound is not set to stream and needs to load first.
Problems Outstanding:
1. Sometimes the sound object loads sometimes it doesnt (ie. Sometimes a number WON'T show up in the duration box.)
2. White boxes appear in front of the first two images
3. Images aren't transitioning. That code doesn't want to repeat. The images are displayed at 5% opacity and then stop.
"I really must get a thinner pencil. I ca'n't manage this one a bit: it writes all manner of things that I don't intend". // Alice, Through the Looking Glass
"I really must get a thinner pencil. I ca'n't manage this one a bit: it writes all manner of things that I don't intend". // Alice, Through the Looking Glass
it sets a space of 2/10ths of a second (from the end of the first transition to the beginning of the second) for the playhead to fall into (in case there is some skipping when I set it to streaming)
to instigate the alpha transition between the two.
Yeah, just saw that. I was thinking _root["pictrans"...] was a movieclip or something, so I didn't understand why you were subtracting a number from it. I think I need some caffeine.
"I really must get a thinner pencil. I ca'n't manage this one a bit: it writes all manner of things that I don't intend". // Alice, Through the Looking Glass
No, it seems to be working fine for me, except for the alpha thing, it stays at 5%. Here's the code that changes the alpha:
code:
if (_root["pic"+trans]._alpha <= 100) {
_root["pic"+trans]._alpha += 5;
_root["pic"+(trans-1)]._alpha -= 5;
} else {
//makes caption visible after new image is at 100%
_root["pic"+trans].caption._visible = true;
//remove image that has alpha of 0
_root["pic"+(trans-1)].removeMovieClip();
}
But if you watch the tracing closely, you'll see that this line gets evaluated as true only once:
Since the first if-statement is inside (a child) this latter one (the parent), the parent only gets executed once, so the alpha values only change once. You of course want the child if statement to execute over and over again. So the trick is to either get the parent if statement to evaluate to true more often than once every transition, or put the child if statement outside the parent, as its own function, so it can execute on its own. I'm looking at your picMovieMC now to see if I can determine why the child if statement I mentioned only evaluates to true once.
Here's the traces I'm using, it shows the numbers better:
code:
trace(mySound.position/1000 + " > " + firstTransition + " && " + mySound.position/1000 + " <= " + secondTransition);
if (((mySound.position/1000) > firstTransition) && ((mySound.position/1000) <= secondTransition)) {
trace("HEY! "+ trans);
_root["pic"+(trans-1)].caption.removeTextField();
// makes images transition
trace("alpha: " + _root["pic"+trans]._alpha);
if (_root["pic"+trans]._alpha <= 100) {
_root["pic"+trans]._alpha += 5;
_root["pic"+(trans-1)]._alpha -= 5;
} else {
//makes caption visible after new image is at 100%
_root["pic"+trans].caption._visible = true;
//remove image that has alpha of 0
_root["pic"+(trans-1)].removeMovieClip();
}
trace("successfully changed trans");
//look for next transition
_global.trans++;
}
"I really must get a thinner pencil. I ca'n't manage this one a bit: it writes all manner of things that I don't intend". // Alice, Through the Looking Glass
"I really must get a thinner pencil. I ca'n't manage this one a bit: it writes all manner of things that I don't intend". // Alice, Through the Looking Glass
Ah, I see. All variables declared inside the parentheses of a for loop -- e.g.
code:
for ( . . . variables here . . . ) {
. . . but not here . . .
} // end for loop
-- are defined by default as local variables. That means they only exist inside the for loop. Since you're trying to access it outside the loop, it has no value. You can see this if you trace the "i" in your picMovieMC, you'll get "undefined". Try setting a global variable called "count" or something so that the variable will be accessible from any timeline. Of course, if you do that, be sure to use
"I really must get a thinner pencil. I ca'n't manage this one a bit: it writes all manner of things that I don't intend". // Alice, Through the Looking Glass