djeurvaisse
10-12-2009, 07:56 AM
Hi to all of you,
First of I'm a newcomer in the world of coding for only a month or so...
These days I've been working on an "auto-scroll" vertical gallery where I'm calling a XML file into Flash using AS 1/2. This XML contains my gallery and images info.
What I want to do is that people will click on an image and this will open a new URL that is stored in the image infos in my XML.
I can't figure what I should type to open that link stored in my XML.
Here I provide you with my XML:
<gallery thumb_width="125" thumb_height="125" gallery_width="125" gallery_height="400" gallery_x="50" gallery_y="50">
<image thumb_url="thumb1.jpg" link="http://connexionjeux.ca/eps1-1.html" target="_self" />
<image thumb_url="thumb2.jpg" link="http://connexionjeux.ca/eps2-1.html" target="_self" />
<image thumb_url="thumb3.jpg" link="http://connexionjeux.ca/eps3-1.html" target="_self" />
<image thumb_url="thumb4.jpg" link="http://connexionjeux.ca/eps4-1.html" target="_self" />
<image thumb_url="thumb5.jpg" link="http://connexionjeux.ca/eps5-1.html" target="_self" />
<image thumb_url="thumb6.jpg" link="http://connexionjeux.ca/personnages.html" target="_self" />
<image thumb_url="thumb7.jpg" link="http://connexionjeux.ca/personnages.html" target="_self" />
</gallery>
and here is my ActionScript:
import mx.transitions.Tween;
import mx.transitions.easing.*;
var myGalleryXML = new XML();
myGalleryXML.ignoreWhite = true;
myGalleryXML.load("gallery.xml");
myGalleryXML.onLoad = function() {
_root.gallery_x = myGalleryXML.firstChild.attributes.gallery_x;
_root.gallery_y = myGalleryXML.firstChild.attributes.gallery_y;
_root.gallery_width = myGalleryXML.firstChild.attributes.gallery_width;
_root.gallery_height = myGalleryXML.firstChild.attributes.gallery_height;
_root.myImages = myGalleryXML.firstChild.childNodes;
_root.myImagesTotal = myImages.length;
_root.thumb_height = myGalleryXML.firstChild.attributes.thumb_height;
_root.thumb_width = myGalleryXML.firstChild.attributes.thumb_width;
callThumbs();
createMask();
scrolling();
};
function callThumbs() {
_root.createEmptyMovieClip("container_mc",_root.getNextHighestDepth());
container_mc._x = _root.gallery_x;
container_mc._y = _root.gallery_y;
var clipLoader = new MovieClipLoader();
var preloader = new Object();
clipLoader.addListener(preloader);
for (i=0; i<myImagesTotal; i++) {
thumbURL = myImages[i].attributes.thumb_url;
myThumb_mc = container_mc.createEmptyMovieClip(i, container_mc.getNextHighestDepth());
myThumb_mc._y = _root.thumb_height*i;
clipLoader.loadClip("thumbs/"+thumbURL,myThumb_mc);
preloader.onLoadStart = function(target) {
target.createTextField("my_txt",target.getNextHighestDepth(),0,0,100,20);
target.my_txt.selectable = false;
};
preloader.onLoadProgress = function(target, loadedBytes, totalBytes) {
target.my_txt.text = Math.floor((loadedBytes/totalBytes)*100);
};
preloader.onLoadComplete = function(target) {
new Tween(target, "_alpha", Strong.easeOut, 0, 100, .5, true);
target.my_txt.removeTextField();
target.onRelease = function() {
callFullImage(this._name);
};
target.onRollOver = function() {
this._alpha = 50;
};
target.onRollOut = function() {
this._alpha = 100;
};
};
}
}
function createMask() {
_root.createEmptyMovieClip("mask_mc",_root.getNextHighestDepth());
mask_mc._x = _root.gallery_x;
mask_mc._y = _root.gallery_y;
mask_mc.beginFill(0x000000,100);
mask_mc.lineTo(_root.gallery_width,0);
mask_mc.lineTo(_root.gallery_width,_root.gallery_height);
mask_mc.lineTo(0,_root.gallery_height);
mask_mc.lineTo(0,0);
container_mc.setMask(mask_mc);
}
function scrolling() {
_root.onEnterFrame = function() {
container_mc._y += Math.cos(((mask_mc._ymouse)/mask_mc._height)*Math.PI)*15;
if (container_mc._y>mask_mc._y) {
container_mc._y = mask_mc._y;
}
if (container_mc._y<(mask_mc._y-(container_mc._height-mask_mc._height))) {
container_mc._y = mask_mc._y-(container_mc._height-mask_mc._height);
}
};
}
All I need is a clue on how I can call that URL stored in my XML, no need to give me the answer. (and I'm open to any ideas you can have)
Thanks to all of you.
Djeurvaisse
http://connexionjeux.ca
First of I'm a newcomer in the world of coding for only a month or so...
These days I've been working on an "auto-scroll" vertical gallery where I'm calling a XML file into Flash using AS 1/2. This XML contains my gallery and images info.
What I want to do is that people will click on an image and this will open a new URL that is stored in the image infos in my XML.
I can't figure what I should type to open that link stored in my XML.
Here I provide you with my XML:
<gallery thumb_width="125" thumb_height="125" gallery_width="125" gallery_height="400" gallery_x="50" gallery_y="50">
<image thumb_url="thumb1.jpg" link="http://connexionjeux.ca/eps1-1.html" target="_self" />
<image thumb_url="thumb2.jpg" link="http://connexionjeux.ca/eps2-1.html" target="_self" />
<image thumb_url="thumb3.jpg" link="http://connexionjeux.ca/eps3-1.html" target="_self" />
<image thumb_url="thumb4.jpg" link="http://connexionjeux.ca/eps4-1.html" target="_self" />
<image thumb_url="thumb5.jpg" link="http://connexionjeux.ca/eps5-1.html" target="_self" />
<image thumb_url="thumb6.jpg" link="http://connexionjeux.ca/personnages.html" target="_self" />
<image thumb_url="thumb7.jpg" link="http://connexionjeux.ca/personnages.html" target="_self" />
</gallery>
and here is my ActionScript:
import mx.transitions.Tween;
import mx.transitions.easing.*;
var myGalleryXML = new XML();
myGalleryXML.ignoreWhite = true;
myGalleryXML.load("gallery.xml");
myGalleryXML.onLoad = function() {
_root.gallery_x = myGalleryXML.firstChild.attributes.gallery_x;
_root.gallery_y = myGalleryXML.firstChild.attributes.gallery_y;
_root.gallery_width = myGalleryXML.firstChild.attributes.gallery_width;
_root.gallery_height = myGalleryXML.firstChild.attributes.gallery_height;
_root.myImages = myGalleryXML.firstChild.childNodes;
_root.myImagesTotal = myImages.length;
_root.thumb_height = myGalleryXML.firstChild.attributes.thumb_height;
_root.thumb_width = myGalleryXML.firstChild.attributes.thumb_width;
callThumbs();
createMask();
scrolling();
};
function callThumbs() {
_root.createEmptyMovieClip("container_mc",_root.getNextHighestDepth());
container_mc._x = _root.gallery_x;
container_mc._y = _root.gallery_y;
var clipLoader = new MovieClipLoader();
var preloader = new Object();
clipLoader.addListener(preloader);
for (i=0; i<myImagesTotal; i++) {
thumbURL = myImages[i].attributes.thumb_url;
myThumb_mc = container_mc.createEmptyMovieClip(i, container_mc.getNextHighestDepth());
myThumb_mc._y = _root.thumb_height*i;
clipLoader.loadClip("thumbs/"+thumbURL,myThumb_mc);
preloader.onLoadStart = function(target) {
target.createTextField("my_txt",target.getNextHighestDepth(),0,0,100,20);
target.my_txt.selectable = false;
};
preloader.onLoadProgress = function(target, loadedBytes, totalBytes) {
target.my_txt.text = Math.floor((loadedBytes/totalBytes)*100);
};
preloader.onLoadComplete = function(target) {
new Tween(target, "_alpha", Strong.easeOut, 0, 100, .5, true);
target.my_txt.removeTextField();
target.onRelease = function() {
callFullImage(this._name);
};
target.onRollOver = function() {
this._alpha = 50;
};
target.onRollOut = function() {
this._alpha = 100;
};
};
}
}
function createMask() {
_root.createEmptyMovieClip("mask_mc",_root.getNextHighestDepth());
mask_mc._x = _root.gallery_x;
mask_mc._y = _root.gallery_y;
mask_mc.beginFill(0x000000,100);
mask_mc.lineTo(_root.gallery_width,0);
mask_mc.lineTo(_root.gallery_width,_root.gallery_height);
mask_mc.lineTo(0,_root.gallery_height);
mask_mc.lineTo(0,0);
container_mc.setMask(mask_mc);
}
function scrolling() {
_root.onEnterFrame = function() {
container_mc._y += Math.cos(((mask_mc._ymouse)/mask_mc._height)*Math.PI)*15;
if (container_mc._y>mask_mc._y) {
container_mc._y = mask_mc._y;
}
if (container_mc._y<(mask_mc._y-(container_mc._height-mask_mc._height))) {
container_mc._y = mask_mc._y-(container_mc._height-mask_mc._height);
}
};
}
All I need is a clue on how I can call that URL stored in my XML, no need to give me the answer. (and I'm open to any ideas you can have)
Thanks to all of you.
Djeurvaisse
http://connexionjeux.ca