Post edited 9:19 pm – June 30, 2009 by dalen
Post edited 9:23 pm – June 30, 2009 by dalen
Post edited 9:33 pm – June 30, 2009 by dalen
http://tutorials.flashmymind.c…..nscript-3/
The above tutorial is the closest I have found to help me in my project that I am currently trying to wrap up.
[After about 9 years... lol...though not far from the truth.]
However my set up is a bit different, and I am so happy that I was able to achieve a working xml loader for a scrolling
thumbnail as well as the associated images it loads, that I dont want to tamper with that code at all. [Just lining it up
was pretty non-intuitive and took hours into the wee morning to figure out how to adjust it to the graphics.]
I have been stuck on this issue since this past Friday, and here it is short and simple.
- I have 17 buttons, made with the flash button function, that need to call up the xml data so it does not automatically
load as it does now. This could be done in an array, though I originally had stripped out the actionscript and applied it
directly to the button in flash [i.e. silk_paintings] to have it call up the xml from there…I tried to use some of the code
from the tutorial here but could not get it to work with what I had. [im sure it can, Im just not that fluid with
programming by any stretch of the imagination...Im still waiting for Adobe to come out with a feature where you drag a
feature on a button and fill out its parameters.]
- The second issue, which at this point is irrelevant if I cant get the button to call up the xml, is to have the button stay
the transparent blue that it is when its in the 'hit' state. [again Im sure this can be done in xml, but I have not seen it
implemented in quite the way I currently have it set up.]
I dont have a webhosting provider yet, so I took a screenshot of what it looks like when it loads in the scrolling
thumbnail with the associated image, as well as the layers in the main movie where the actionscript for calling up the xml
lies.
Below I will post the actionscript & xml currently used.
The trick again is to get the buttons, when clicked, to execute the script vs. it automatically loading.
Just to clarify, I plan on duplicating the script and renaming it according to which button its associated with.
[im sure it could all be done with one document, but for now it may be easier for me to break it up like this.]
Thanks in advance for taking a look and for the help!
Peace
Dalen
stop();
fscommand(”allowscale”, false);//keep SWF display at 100%
var x:XML = new XML ();//Define XML Object
x.ignoreWhite = true;
var fullURL:Array = new Array;//Array of full size image urls
var thumbURL:Array = new Array;//Array of thumbnail urls
var thumbX:Number = 25;//Initial offset of _x for first thumbnail
x.onLoad = function(){ //Function runs after XML is loaded
var photos:Array = this.firstChild.childNodes;//Defines variable for length of XML file
for (i=0;i
var t = panel.attachMovie(”b”,”b”+i,i);//Each loop, Define local variable 't' as a new instance of 'b' movie clip, given unique instance name of 'b' plus the index number of the For loop t.img.loadMovie(thumbURL[i]);// Each loop, load thumbnail image from XML data into variable movie clip
t._y = 0;//Set Y coordinate of variable movie clip
t._x = thumbX;//Set X coordinate of variable movie clip based on variable thumbX
t.numb = i;//Set sub-variable 'numb' inside variable t to hold index number
t._alpha = 75;//Set the Alpha value of the variable movie clip to 75% – for onRollOver highlight action
thumbX += 55;//Increment thumbX value so next thumbnail is placed 125 pixels to the right of the one before
t.onRollOver = function () {//define onRollOver event of the variable movie clip
this._alpha = 100;//Set thumbnail alpha to 100% for highlight
}
t.onRollOut = function () {//define onRollOut event of the variable movie clip
this._alpha = 75;//Reset thumbnail alpha to 75%
}
t.onPress = function () {//define onPress event of the variable movie clip
this._rotation += 3;//rotates thumbnail 3 degrees to indicate it's been pressed
this._x += 3;//Offset X coordinate by 3 pixels to keep clip centered during rotation
this._y -= 3;//Offset Y coordinate by 3 pixels to keep clip centered during rotation } t.onReleaseOutside = function () {//define onRelease event of the variable movie clip
this._rotation -= 3;//rotate thumbnail back 3 degrees
this._x -= 3;//Reset X coordinate by 3 pixels to keep clip centered during rotation
this._y += 3;//Reset Y coordinate by 3 pixels to keep clip centered during rotation this._alpha = 75;//Reset thumbnail alpha to 75%
}
t.onRelease = function () {//define onRelease function to load full sized image
this._rotation -= 3;//rotate thumbnail back 3 degrees
this._x -= 3;//Reset X coordinate by 3 pixels to keep clip centered during
this._y += 3;//Reset Y coordinate by 3 pixels to keep clip centered during
this._alpha = 75;//Reset thumbnail alpha to 75%
holder.loadMovie(fullURL[this.numb]);//Load full sized image into holder clip based on sub- variable t.numb, referenced by 'this'
}
}
holder.loadMovie(fullURL[0]);//Initially load first full size image into holder clip
}
x.load (”silk_paintings.xml”);// path to XML file
panel.onRollOver = panelOver;
function panelOver() {
this.onEnterFrame = scrollPanel;
delete this.onRollOver;
}
var b = stroke.getBounds(_root);
function scrollPanel() {
if (_xmouseb.xMax||_ymouseb.yMax) {
this.onRollOver = panelOver;
delete this.onEnterFrame;
}
if (panel._x >= 740) {
panel._x = 740;
}
if(panel._x <= (thumbX-10)) {
panel._x = (thumbX-10)
}
var xdist = _xmouse – 830;
panel._x += -xdist / 7;
}