This content has been marked as final. Show 4 replies
not bad, but a couple of things. The use of the keyword 'this' within your code could get you into a little trouble with scope. When used within a method it can apply to the Object on which the method has been called on, and not the main timeline scope, although it is still working for you here. Also it is being compounded by the fact that you have constructed your methods using prototyping, which further defines the scope of 'this' to the Object that the method is being applied to, again, still working for you here. Usually we would define 'named functions' (methods) to handle these oprations rather than using prototyping, since prototyping constructs a 'universal' method that comes part of the parent class that the prototype it is called on. With prototypes you can call a method on any instance at any given time from anywhere within the scope of your document, yet again, still working for you here ...
I would remove all references of 'this' and construct these as named methods, rather than prototypes, and maybe save some problems down the road.
But to the question:
From within the thumbnail's on handler (which you must be setting up manually) you need to assign the pIndex to the value corrsponding to the thumb, and then call the 'changePhoto' method, and pass 0 for d.
But because you have these built as prototypes you'll need ot be careful how you call the method, and assign the var value, I think:
_level0.pIndex = #; //thumb index number
just to make sure it's not being applied to the thumb's scope. Hope 'this' helps LOL!! :)
Thanks very much for your reply, clbeech! Unfortunately, your descriptions of named methods vs. prototypes goes way over my head.
Yes, I was assigning the GET URL tag to each thumbnail, and I'm at a loss of how to get the thumbs to load into the "photo" instance. I copied your suggested string into one of my thumbnails (see attached code). I'm obviously not utilizing the code correctly, and I'm unsure where/if I should modify the action script in the master scene to accomodate the new string. I'm sorry to be a nuisiance, but I'm sort of stabbing in the dark, so any and all help would be great!
At the beginning of your code, pIndex is defined as a Number, whcih is zero; but in your button event, your redefine pIndex as a string. Since the changePhoto method oerrides pindex again anyways, that line in your button event does not do anything. pIndex seems to be an internal counter for which image is currently shown; according to your code you shouldn't have to mess with it directly. Try omitting the first line in your button event where you set pIndex, and just use the second line. If that doesn't work, try putting a few trace statements which read
...and see what you get. If the trace returns anything else than _level0, then you've got a scope issue on your hands.
Thanks, Joe! I plugged in your code, but all it does is reload whatever image is currently loaded.
As far as the "trace(this);" statement, do I place that in the button event or in the master scene actionscript? How would I customize the statement - something like this: