XML image gallery problem
Hi! I've builded this XML gallery, and suddenly Im getting an
error when Im loading the pictures.
Its only sometimes the error comes.
TypeError: Error #2007: Parameter url must be non-null.
at flash.display::Loader/_load()
at flash.display::Loader/load()
at imageviewer_xml_subcats_fla::MainTimeline/allLoadXML()
at
imageviewer_xml_subcats_fla::MainTimeline/goForwardSorted()
at imageviewer_xml_subcats_fla::MainTimeline/sortMe()
Can anyone help me?
Flash file incl XML
imageview.fla
I noticed two thing:
1. I guess the error occurs when currentImage variable is out
of range of sortedXML array. You, perhaps need to trace this var
and see at what point the error happens.
2. Unless I missed someting, It seems that you always load
images. At some point you load images that are already loaded. It
is inefficient. You, perhaps, better off reusing already loaded
images.
Similar Messages
-
Hi Everyone,
I've seen a really cool XML image gallery on the followng page: http://www.webbers.co.uk/property/view/id/6407
Does anyone know of a tutorial which may help me create something similar?
Regards.http://www.flashxml.net/cover-flow.html
-
HELP! - XML Image gallery, simple problem
I've posted this problem before and gotten no response. Very
simple I'm sure, I just don't know much Flash. Basically I've
created an image gallery that should look like this:
http://www.flashcomponents.net/upload/samples/1448/index.html.
The problem is that the thumbnails are not being accessed properly
(from what I can tell), making it look like this:
http://shortydesigns.com/index.html.
The images are all in the same folder and since one thumbnail is
loading, I can't see why the others aren't. The Actionscript in the
Flash file is as follows (it was created with Flash 10):
First Piece of Code
stop();
// specify the url where folder is located below (if
applicable)
toadd = "";
t = 0;
l = 0;
theside = 1;
galxml = new XML();
galxml.load(toadd+"flash/fashion/easy-xml-gallery-2.xml");
galxml.ignoreWhite = true;
galxml.onLoad = function(success) {
if (success) {
maxnum = galxml.firstChild.childNodes.length;
for (n=0; n<maxnum; n++) {
specs = galxml.firstChild.childNodes[n];
// TEXT FOR SIDE NAV
duplicateMovieClip(side.thumbs.thumbsb, "thumbs"+n, n);
thumbclip = eval("side.thumbs.thumbs"+n);
thumbclip._x = n*100;
thumbclip.thetitle = specs.attributes.name;
thumbclip.theurl = specs.attributes.theurl;
thumbclip.thecaption = specs.attributes.caption;
thumbclip.thenum = n+1;
thumbclip._alpha = 100;
loadMovie(toadd+"flash/fashion/images/"+(n+1)+"b.jpg",
thumbclip.thumbload.thumbload2);
play();
side.thumbs.thumbsb._visible = false;
mainperc.onEnterFrame = function() {
if (mainperc.perc<98) {
mainperc._alpha += 5;
mainperc.perc = Math.round(l/t*100);
mainperc.perctext = mainperc.perc+"%";
mainperc.ltext = "OF THUMBNAILS LOADED
("+Math.round(t/1024)+"kb)";
if (mainperc.perc>98) {
// mainperc._alpha -= 5;
if (mainperc._alpha<-50) {
delete mainperc.onEnterFrame;
Later in the timeline:
stop();
pic.info.thenum = side.thumbs.thumbs0.thenum;
pic.info.thecaption = side.thumbs.thumbs0.thecaption;
pic.info.thetitle = side.thumbs.thumbs0.thetitle;
pic.info.theurl = side.thumbs.thumbs0.theurl;
loadMovie(_root.toadd+"flash/fashion/images/1.jpg",
pic.pic2.pic3);
onEnterFrame = function () { side.gotoa = 110;if
(side._alpha>99) {side._alpha = 100;delete
onEnterFrame;}side.lefta = side.gotoa-side._alpha;side._alpha +=
side.lefta/5;pic._alpha = side._alpha;};I noticed two thing:
1. I guess the error occurs when currentImage variable is out
of range of sortedXML array. You, perhaps need to trace this var
and see at what point the error happens.
2. Unless I missed someting, It seems that you always load
images. At some point you load images that are already loaded. It
is inefficient. You, perhaps, better off reusing already loaded
images. -
Anyone have a good tutorial for an AS3-XML image gallery?
I'm a pretty good Flash developer, but I've never worked with XML in Flash. I'm looking for a good tutorial on creating an XML driven image gallery, but I have yet to really find anything. Does anyone out there have a good tutorial? Thanks!
JesseYour best bets for getting something more specific to your needs will either be to...
- search Google using terms like "AS3 XML gallery tutorial" and "AS3 XML slideshow tutorial"
- take one fairly complicated tutorial and learn how it works down to understanding each element of what is being done. Once you a proper level of understanding you should be able to reason out how to create one of your own with whatever different features you prefer -
I'm creating my first xml driven image gallery in AS3 and could use some help. It's a pretty basic gallery that consists of a large image with thumbnails below it. You should see the large version of the thumbnails when you click on them, they should rotate chronilogically on it's own (use timer event?), and you should be able to scroll left or right in order to view additional thumbnails.
Below is what I have so far. My first task is to get the thumnails to line up correctly. I got the y value correct, but I need to space them out by 10px appropriatley. How can I do this? Thanks!
Jesse
import flash.events.Event;
import flash.display.MovieClip;
import flash.display.Loader;
import flash.net.URLRequest;
import flash.events.MouseEvent;
import fl.transitions.Tween;
import fl.transitions.easing.*;
import fl.transitions.TweenEvent;
import flash.events.ProgressEvent;
var myXML:XML;
var myXMLLoader:URLLoader = new URLLoader();
myXMLLoader.load(new URLRequest("images.xml"));
myXMLLoader.addEventListener(Event.COMPLETE, processXML);
var myImagePreloader:mcPreloader = new mcPreloader();
myImagePreloader.x = stage.stageWidth / 2;
myImagePreloader.y = stage.stageHeight / 2;
myImagePreloader.width = 75;
myImagePreloader.height = 75;
var container_mc:MovieClip;
var xCounter:Number = 0;
function processXML(event:Event):void
myXML = new XML(myXMLLoader.data);
myXMLLoader.removeEventListener(Event.COMPLETE, processXML);
myXMLLoader = null;
//createContainer();
loadThumbs();
function createContainer():void
container_mc = new MovieClip();
//container_mc.x = my_x;
container_mc.y = 510;
addChild(container_mc);
/*container_mc.addEventListener(MouseEvent.CLICK, callFull);
container_mc.addEventListener(MouseEvent.MOUSE_OVER, onOver);
container_mc.addEventListener(MouseEvent.MOUSE_OUT, onOut);*/
container_mc.buttonMode = true;
/*preloaders_mc = new MovieClip();
preloaders_mc.x = container_mc.x;
preloaders_mc.y = container_mc.y;
addChild(preloaders_mc);*/
function loadThumbs():void
var thumbLoader:Loader = new Loader();
for(var i:Number = 0; i < myXML.image.length(); i++)
var thumbURL = myXML.image[i].@thumb;
thumbLoader.load(new URLRequest(thumbURL));
thumbLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, thumbLoaded);
thumbLoader.y = 510;
//trace(imageWidth);
function loadFull():void
var fullImageLoader:Loader = new Loader();
//var imageURL = myXML.image[i].@file;
/*fullImageLoader.load(new URLRequest(imageURL));
fullImageLoader.contentLoaderInfo.addEventListener(Event.OPEN, addPreloader);
fullImageLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, preloadImages);
fullImageLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, imageLoaded);*/
/*function addPreloader(event:Event):void
addChild(myImagePreloader);
function preloadImages(event:ProgressEvent):void
var percent:Number = Math.round(event.bytesLoaded / event.bytesTotal * 100);
percent_txt.text = percent + "%";
function imageLoaded(event:Event):void
var myLoadedImage:Loader = Loader(event.target.loader);
addChild(myLoadedImage);
new Tween(myLoadedImage, "alpha", Strong.easeIn, 0, 1, 0.5, true);
percent_txt.text = "";
removeChild(myImagePreloader);
event.target.loader.removeEventListener(Event.OPEN, addPreloader);
event.target.loader.removeEventListener(ProgressEvent.PROGRESS, preloadImages);
event.target.loader.removeEventListener(Event.COMPLETE, imageLoaded);
function thumbLoaded(event:Event):void
var myLoadedThumb:Loader = Loader(event.target.loader);
addChild(myLoadedThumb);What you will want to do is maintain a placement variable that you adjust for each new thumbnail you add. So the first might go at xValue = 0. Once that thumbnail is processed you then add the width of that thumbnail plus the 10 pixels space you want.
If you know that the widths will all be the same and what that value is, then you can assign the location for the thumbnail loader prior to it loading like you do for the y property.
Otherwise, you will need to wait until the thumbnail has loaded before you can determine the width... which would mean you will need to load the thumbnails sequencially rather than using a for loop since they will not necessarily load in the order they are executed to do so. It is basically somewhat like what relaxatraja provided except using the width property. -
Flash simple image gallery problem
Hello I have what I think is an easy problem to solve but I
can´t find a solution.
I´m creating an image gallery with thumbnails on the
right inside a symbol so that
they can all fade in at the same time, and the bigger images
on the left that also fade in.
I can only fit 8 thumbnail images at a time, and want to have
more than that.
So I´ll add an arrow below the thumbs so that when you
click on it, you can see the other thumbs.
I have the first 8 thumbs on the first frame of a symbol and
the rest on the second frame.
My problem is that the symbol that contains the thumbs is a
graphic symbol, so that the thumbs in it, that are button symbols
can be clicked on. I tried using button and movie clip symbols for
the thumbnails container but then the buttons (thumbs) can´t
be clicked any more.
That was not a problem till I had to add more than 8 thumbs,
cause i need to give the container an instance name, and graphic
symbols can´t have one.
Here is the link to download the .fla
www.ginkgo.com.uy/old/downloads/handheld_pink.fla
In case I didn´t make my self clear, what I need is to
know if there´s a way to have a movie clip or button symbol
that can have buttons in it that can be clicked on.
I hope I didn´t give you a headache.
Thanks a lot, Marcelo.thanks.
that´s what i thought but, if i convert the container to
a button symbol the thumbs can´t be clicked anymore.
And if I convert the container to a movie clip like you
suggested, then if I click on any part of the container it
just goes to the second frame of the movie clip container, if
i click again it goes back to the first frame and so on.
But there is no action script for the container at all,
please try it out with the fla i uploaded.
i can´t figure it out.
thanks -
Scrolling image gallery problems
I am creating a scrolling image gallery using thumbnails. I have 36 thumbnails that are 100 x 100 px. I cannot figure out the x y coordinates to line up the images correctly. They are overlapping. I've put in the first x coordinate at 0 and the first image goes to the left, and that is fine, it is when I click the last image to put in a number, which I thought would be 36 x 100, they do not line up, they over lap. Does anyone have a clue how to fix this? I am working on this site for a very pushy client who wants it done NOW...Thanks,
If you crerate a Sprite or Movieclip 3600 x 100 you can place then one after another on that container then you only have 1 object to place and scroll.
-
hi guys
I recently bought 5800 and i have a question: why does image gallery show all pictures that's on memory card? even if they aren't in picture folder, for example it shows all power mp3 skins, and they r stored in power mp3 directory.
So if i decide to have some private pictures on memory card i cant it will be all shown in Images & Videos, its like phone scans my card and all that is picture file he put in gallery.
thanks in advance !Have a look at this..
/t5/Nseries-and-S60-Smartphones/Password-protect-a-folder-on-application-screen/td-p/645383
--------------------------------------------------------------------------------------------------------------------------------------------------------------If you find this helpful, pl. hit the White Star in Green Box... -
Preloader for xml image gallery
Hi,
I am a little stuck as to where to begin; I have created a
photo gallery and now need to add some preloader capability to it.
The images are brought in via XMLList etc... What I have in mind, I
would like to display a preloader untill all the images are ready
for viewing - not wanting to preload individual images one by one
I also have a document class within the gallery swf file, I
beleive that this may cause conflicts with attaching a preloader to
frame 1 - I have tried preloading the gallery swf file via a
preloader.swf; the end result still leaves me with having to
provide a preloader within the gallery swf.
Can anyone point me to any good examples, for me to get on
with it. Any help would be really appreciated folks ;)
Kind Regards,
Boxing BoomHi Kglad,
Thank you for your response: my images are loading sequentially via the following code segment;
//initialize the loader object
loader=new Loader();
//add an onInit event to the contentLoadedInfo
loader.contentLoaderInfo.addEventListener(Event.INIT, onImageLoaded);
//create the fake holder
fakeHolder=new Sprite();
//and add to it the loader
fakeHolder.addChild(loader);
//no need to add it to the stage
//force the resizeHandler to be called
resizeHandler(null);
//Load the XML file
xmlLoader=new URLLoader();
//assign the Complete loading event
xmlLoader.addEventListener(Event.COMPLETE,parseXML);
//load the file
xmlLoader.load(new URLRequest("data.xml"));
//initialize the url request
urlRequest=new URLRequest();
What I would like to do now is preload these,
Would the code to acheive this be:
xmlLoader.addEventListener(ProgressEvent.PROGRESS ,onProgress);
private function onProgress(pe:ProgressEvent):void
// this bit is what I do not understand; i.e. your x/n + bl/(bt*n) fraction example
Any further help on this on, would be really appreciated Kglad.
Kind Regards,
Boxing Boom -
Table Image Gallery Problem - Stretching / Distortion
I am using tables for making image galleries and they have worked fine up until my most recent gallery which has images of different orientations: 3 landscape-style images and 2 portrait-style.
The first (and only) large image I inserted into the table was landscape-style, and the 3 images of this type work fine. I used the 'Swap Image' behavior for each of the thumbnails I have below the large image. The problem is that the portrait-style images get stretched / distorted horizontally to fit the same dimensions as the landscape-style images.
I've tried looking at the code to modify dimensions of the images but there are only dimensions for the 1st/only large image. I've also tried lengthening the height of the container div and the div inside it which contains the table gallery, but this did not fix my issue.
I am somewhat new to Dreamweaver so this may be sort of a beginner's question, but I am hoping someone might help me to figure out how to make the portrait-style images be their original size and not stretched / distorted.
If necessary I can provide the code and try to provide more info.
Thanks!I played around with the code some more and changed both the height and width of the (ID: #large) image to "auto" which seems to have fixed the stretching and distortion.
However, if possible, I'd still like to be able to center the portrait-style images in the table. Does anyone know how to do that?
The updated page is visible here: http://www.csulb.edu/~mmccutch/misc2.html -
External image gallery problem
Hi,
I'm getting a strange problem with my gallery which uses
external images. The first time you open the page with the gallery
on, all of the pictures are full size and overlap each other but
then when you press refresh all the images shrink down to there
inteded size and the gallery works perfectly. This seems very
strange that it fixs itself. Anyone got any ideas?
heres a link to some screen shots of the gallery breaking:
http://www.atumstudios.com/test/error/
Here is a link to the actual gallery page:
Shriba Artware Gallery
pageHave a look at this..
/t5/Nseries-and-S60-Smartphones/Password-protect-a-folder-on-application-screen/td-p/645383
--------------------------------------------------------------------------------------------------------------------------------------------------------------If you find this helpful, pl. hit the White Star in Green Box... -
Image Gallery, problems with Flash player 9 and Opera 9
Hi, I'm developing a slideshow in flash (and php, JavaScript,
XML).
I'm coding in classes and AS2.
I use the ExternalInterface class to communicate between
swf's and html.
The problem is that the Slideshow won't work properly in the
Opera browser,
it seems like it's working fine, but after a few click it
stop responding.
No problems in IE and FF.
I've search and search to find a solution to this problem
with no luck.
I've put up an example of the slideshow here:
http://www.coldminer.com/up/sw.php?thumbs=1
The strange thing is that when I use really simplified
versions of the code
I'm using (with no externalInterface etc) it is working fine:
http://www.coldminer.com/ftest/
Anyone who have experienced similar problems, and can guide
me to a solution.
Opera version: 9.02 (8585)
Flash player version: 9,0,16,0
Thank you!
** Edit ->
I found a solution, I replaced th ExternalInterface with the
"Flash JavaScript Integration Kit",
and all my problems with Opera was solved.Lo stesso problema ce l'ho io. Sembra che flash player 9 non
riesca a leggere le versioni flash 5. Nell'installare un corso
contenente flash 5 ho questo errore:
Prodotto: Corso Multimediale per Photoshop 7 -- Errore 1904.
Impossibile registrare il modulo C:\WINDOWS\system32\swflash.ocx.
HRESULT -2147319780. Contattare il personale di supporto. -
Flash Image Gallery load problem
This a familiar problem that has been put up here a thousand
times I'm sure but as yet I haven't been able to find a solution
for it. I've put together a simple image gallery using Flash and an
XML file. It works perfectly on my system but there are issues with
the images loading properly when I put them onto my site. I know
very little Flash, I've been using a pre-made gallery that I
downloaded but since it works on my computer I assume I should be
able to get it to work online too. The thumbnails for the file seem
to work fine and the information from the XML file is obviously
being accessed, however the main images are not loading. I've
included all the code below (Actionscript, XML and the Web coding),
if someone could help me before I put my fist through a wall that
would be great:
Actionscript
stop();
//specify the url where folder is located below (if
applicable)
toadd="";
t = 0;
l = 0;
theside = 1;
galxml = new XML();
galxml.load(toadd+"flash/fashion/easy-xml-gallery-2.xml");
galxml.ignoreWhite = true;
galxml.onLoad = function(success) {
if (success) {
maxnum = galxml.firstChild.childNodes.length;
for (n=0; n<maxnum; n++) {
specs = galxml.firstChild.childNodes[n];
//TEXT FOR SIDE NAV
duplicateMovieClip(side.thumbs.thumbsb, "thumbs"+n, n);
thumbclip = eval("side.thumbs.thumbs"+n);
thumbclip._x = n*100;
thumbclip.thetitle = specs.attributes.name;
thumbclip.theurl = specs.attributes.theurl;
thumbclip.thecaption = specs.attributes.caption;
thumbclip.thenum = n+1;
thumbclip._alpha = 100;
loadMovie(toadd+"/flash/fashion/images/"+(n+1)+"b.jpg",
thumbclip.thumbload.thumbload2);
play();
side.thumbs.thumbsb._visible = false;
mainperc.onEnterFrame = function() {
if (mainperc.perc<98) {
mainperc._alpha += 5;
mainperc.perc = Math.round(l/t*100);
mainperc.perctext = mainperc.perc+"%";
mainperc.ltext = "OF THUMBNAILS LOADED
("+Math.round(t/1024)+"kb)";
if (mainperc.perc>98) {
//mainperc._alpha -= 5;
if (mainperc._alpha<-50) {
delete mainperc.onEnterFrame;
XML
<gallery>
<pic1 name="ONE">
<pic2 name="TWO"/>
<pic3 name="THREE"/>
<pic4 name="FOUR"/>
<pic5 name="FIVE"/>
<pic6 name="SIX"/>
<pic7 name="SEVEN"/>
<pic8 name="EIGHT"/>
<pic9 name="NINE"/>
<pic10 name="TEN"/>
</gallery>
Webpage coding
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "
http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="
http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=utf-8" />
<title>shorty designs</title>
<style type="text/css">
<!--
body,td,th {
font-family: Verdana, Arial, Helvetica, sans-serif;
color: #666666;
body {
margin-left: 0px;
margin-top: 0px;
background-image: url(images/fashion_back.gif);
background-repeat: no-repeat;
a:hover {
color: #999999;
text-decoration: none;
.Sections {
color: #333333;
font-weight: bold;
#wrapper {
background-color: #FFFFFF;
padding: 10px;
width: 760px;
margin-right: auto;
margin-left: auto;
.section_reg {
color: #333333;
font-weight: bold;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: large;
padding-left: 10px;
.contact {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: large;
color: #333333;
background-color: #FFFFFF;
width: 400px;
padding-left: 22px;
text-align: right;
.section_back {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: large;
color: #FFFFFF;
background-color: #000000;
width: 135px;
padding-left: 10px;
margin-top: 15px;
margin-bottom: 15px;
background-position: center center;
vertical-align: middle;
height: auto;
.style2 {color: #F0F0F0}
a:link {
text-decoration: none;
color: #333333;
a:visited {
text-decoration: none;
color: #333333;
a:active {
text-decoration: none;
-->
</style>
<script src="Scripts/AC_RunActiveContent.js"
type="text/javascript"></script>
</head>
<body>
<div id="wrapper">
<p class="Sections"><img src="images/version5.jpg"
alt="shorty logo" width="166" height="85" /><span
class="contact">Contact by email:
[email protected]</span></p>
<p class="Sections">
<script type="text/javascript">
AC_FL_RunContent( 'codebase','
http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0','wid th','536','height','518','align','right','src','/flash/fashion/fashion','quality','high',' pluginspage','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=Shockwa veFlash','movie','/flash/fashion/fashion'
); //end AC code
</script>
<noscript>
<object
classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="
http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0"
width="536" height="518" align="right">
<param name="movie" value="/flash/fashion/fashion.swf"
/>
<param name="quality" value="high" />
<embed src="/flash/fashion/fashion.swf" width="536"
height="518" align="right" quality="high" pluginspage="
http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash"
type="application/x-shockwave-flash"></embed>
</object>
</noscript>
</p>
<p class="section_back">Fashion</p>
<p class="section_reg"><a
href="travel.html">Travel</a></p>
<p class="section_reg"><a
href="wedding.html">Wedding</a></p>
<p class="section_reg"><a
href="layout.html">Layout</a></p>
<p class="section_reg"><a
href="personal.html">Personal</a></p>
</div>
</body>
</html>Yep, these are the directions:
this is very easy to update. You only need to edit the simple
xml file and add images to the images folder.
step 1.
add as many images as you like at the size 536 x 403
step 2.
create thumbnails for the above images at size 100x75
step 3.
update the xml file with the name url and caption for each
image. (to take the url off just click through to the button on the
main picture and delete the script that says getURL(theurl)
step 4.
open flash file and change the 'toadd' variable to the folder
where the flash file and image folder is located on your site.
thats it done.
The frustrating thing now is that the files are finally being
found but the thumbnail function has decided to mess up. -
XML grid gallery not loading full images(except for one)
hi,
I just created my first flash website, but one of my XML image galleries is not working properly. I am using the same (code, layout, just different pics and xml files) gallery on 4 of my pages, however, one("products") of the 4 will not load the "full" images. The thumbnails load, they decrease opacity when moused over, but once you click on one, the progress bar loads till complete and just stops. You can see the problem in action atwww.erikhigbee.com on the "Products" page. This problem, however, only occurred after I hosted it on iPage.com. When I test it (Ctrl+Enter) in Flash, test it in Dreamweaver or open the .html of it from my computer, everything works perfectly. It is only after I FTP upload all the files to iPage's server that this problem occurs. I made sure to keep the filetree the same and everything. Is it a problem with Ipage? Are too many images trying to load??
Furthermore, for some odd reason the 1st image(left), 4th row down on the s"Products" page DOES load the full image but the others still dont and I can't for the life of me figure out why. All the code is exactly the same as on the other pages.
Thanks for any and all help/advice you can give me!
one thought(from posts on other forums) could be inefficient code. Error #2044: Unhandled IOErrorEvent:. text=Error #2036: Load Never Completed. pops up whenever the thumbs are clicked. idk if that helps.
below is the code i used for the gallery. Could anyone take a quick look over it and see if any problems/inefficiencies jump out at ya??
[CODE]import flash.net.URLLoader;
import flash.net.URLRequest;
import flash.events.Event;
import flash.display.MovieClip;
import flash.display.Loader;
import flash.events.MouseEvent;
import fl.controls.ProgressBar;
import fl.transitions.Tween;
import fl.transitions.easing.*;
import fl.transitions.TweenEvent;
var columns:Number;
var my_x:Number;
var my_y:Number;
var my_thumb_width:Number;
var my_thumb_height:Number;
var my_images:XMLList;
var my_total:Number;
var container_mc:MovieClip;
var preloaders_mc:MovieClip;
var full_mc:MovieClip;
var x_counter:Number = 0;
var y_counter:Number = 0;
var my_tweens:Array = [];
var container_mc_tween:Tween;
var full_tween:Tween;
var myXMLLoader:URLLoader = new URLLoader();
myXMLLoader.load(new URLRequest("gallery_hats.xml"));
myXMLLoader.addEventListener(Event.COMPLETE, processXML);
function processXML(e:Event):void{
var myXML:XML = new XML(e.target.data);
columns = myXML.@COLUMNS;
my_x = myXML.@XPOSITION;
my_y = myXML.@YPOSITION;
my_thumb_width = myXML.@WIDTH;
my_thumb_height = myXML.@HEIGHT;
my_images = myXML.IMAGE;
my_total = my_images.length();
createContainer();
callThumbs();
myXMLLoader.removeEventListener(Event.COMPLETE, processXML);
myXMLLoader = null;
function createContainer():void{
container_mc = new MovieClip();
container_mc.x = my_x;
container_mc.y = my_y;
addChild(container_mc);
container_mc.addEventListener(MouseEvent.CLICK, callFull);
container_mc.addEventListener(MouseEvent.MOUSE_OVER, onOver);
container_mc.addEventListener(MouseEvent.MOUSE_OUT, onOut);
container_mc.buttonMode = true;
preloaders_mc = new MovieClip();
preloaders_mc.x = container_mc.x;
preloaders_mc.y = container_mc.y;
addChild(preloaders_mc);
function callThumbs():void{
for (var i:Number = 0; i < my_total; i++){
var thumb_url = my_images[i].@THUMB;;
var thumb_loader = new Loader();
thumb_loader.load(new URLRequest(thumb_url));
thumb_loader.contentLoaderInfo.addEventListener(Event.COMPLETE, thumbLoaded);
thumb_loader.name = i;
thumb_loader.x = (my_thumb_width+10)*x_counter;
thumb_loader.y = (my_thumb_height+10)*y_counter;
if (x_counter+1 < columns){
x_counter++;
} else {
x_counter = 0;
y_counter++;
var preloader_pb:ProgressBar = new ProgressBar();
preloader_pb.source = thumb_loader.contentLoaderInfo;
preloader_pb.x = thumb_loader.x;
preloader_pb.y = thumb_loader.y;
preloader_pb.width = my_thumb_width;
preloader_pb.height = my_thumb_height/10;
preloaders_mc.addChild(preloader_pb);
preloader_pb.addEventListener(Event.COMPLETE, donePb);
function thumbLoaded(e:Event):void{
var my_thumb:Loader = Loader(e.target.loader);
container_mc.addChild(my_thumb);
my_tweens[Number(my_thumb.name)]=new Tween(my_thumb, "alpha", Strong.easeIn, 0,1,0.5, true);
my_thumb.contentLoaderInfo.removeEventListener(Event.COMPLETE, thumbLoaded);
function callFull(e:MouseEvent):void{
var full_loader = new Loader();
var full_url = my_images[e.target.name].@FULL;
full_loader.load(new URLRequest(full_url));
full_loader.contentLoaderInfo.addEventListener(Event.INIT, fullLoaded);
var full_pb:ProgressBar = new ProgressBar();
full_pb.source = full_loader.contentLoaderInfo;
full_pb.x = (stage.stageWidth - full_pb.width)/2;
full_pb.y = (stage.stageHeight - full_pb.height)/2;
preloaders_mc.addChild(full_pb);
full_pb.addEventListener(Event.COMPLETE, donePb);
container_mc.removeEventListener(MouseEvent.CLICK, callFull);
container_mc.buttonMode = false;
container_mc.removeEventListener(MouseEvent.MOUSE_OVER, onOver);
container_mc.removeEventListener(MouseEvent.MOUSE_OUT, onOut);
container_mc_tween = new Tween(container_mc, "alpha", Strong.easeIn, 1,0.5,0.5, true);
function fullLoaded(e:Event):void{
full_mc = new MovieClip();
full_mc.buttonMode = true;
addChild(full_mc);
var my_loader:Loader = Loader(e.target.loader);
full_mc.addChild(my_loader);
full_tween = new Tween(my_loader, "alpha", Strong.easeIn, 0,1,0.5, true);
my_loader.x = (stage.stageWidth - my_loader.width)/2;
my_loader.y = (stage.stageHeight - my_loader.height)/2;
my_loader.addEventListener(MouseEvent.CLICK, removeFull);
my_loader.contentLoaderInfo.removeEventListener(Event.COMPLETE, fullLoaded);
function removeFull(e:MouseEvent):void{
var my_loader:Loader = Loader (e.currentTarget);
full_tween = new Tween(my_loader, "alpha", Strong.easeOut, 1,0,0.5, true);
full_tween.addEventListener(TweenEvent.MOTION_FINISH, tweenFinished);
container_mc_tween = new Tween(container_mc, "alpha", Strong.easeOut, 0.5,1,0.5, true);
function donePb(e:Event):void{
var my_pb:ProgressBar = ProgressBar(e.target);
preloaders_mc.removeChild(my_pb);
my_pb.removeEventListener(Event.COMPLETE, donePb);
function tweenFinished(e:TweenEvent):void{
var my_loader:Loader = Loader (e.target.obj);
my_loader.unload();
full_mc.removeChild(my_loader);
removeChild(full_mc);
full_mc = null;
container_mc.addEventListener(MouseEvent.CLICK, callFull);
container_mc.buttonMode = true;
container_mc.addEventListener(MouseEvent.MOUSE_OVER, onOver);
container_mc.addEventListener(MouseEvent.MOUSE_OUT, onOut);
var my_tween:Tween = Tween(e.target);
my_tween.removeEventListener(TweenEvent.MOTION_FINISH, tweenFinished);
function onOver(e:MouseEvent):void{
var my_thumb:Loader = Loader(e.target);
my_thumb.alpha = 0.5;
function onOut(e:MouseEvent):void{
var my_thumb:Loader = Loader(e.target);
my_thumb.alpha = 1;
[/CODE]Hi,
at www.lynda.com there is a great video tutorial.
Search for Create and Embed a Photo Gallery in a PDF -
Image gallery From an XML file...
Will flash reconize an XML file that is parameter based (Call
Functions) into a database to create a type of listing service to
show homes for sale?
My client is wanting a basic image gallery for now that will
later become a a fullfledged interactive document later down the
road for showing options in the homes they build. First, they have
Spec homes that they want to showcase (simply put these are homes
they already built and are sitting on the property that are move in
ready).
Step 1:
The end user would visit an HTML (CFM) document where they
would choose there search criteria.
Step 2:
then another page would show with an exterior photo of the
home, and a breif description where the user would select the home
they want to view more infomation.
Step 3:
This then would load the image viewer which is the flash
file, that would call to the XML file to load the parameters to
which home model to show.
The home will have a unique home model name in which the
photos are labeled accordingly the same way...
Exterior = ModelHomeName.jpg
Image 1 = ModelHomeName_1.jpg
Image 2 = ModelHomeName_2.jpg
Image 3 = ModelHomeName_3.jpg
Image 4 = ModelHomeName_4.jpg
Image 5 = ModelHomeName_5.jpg
etc...
Is there a certain way flash has to read the XML file with
parameters to translate it? Or what is the quickest possible way?
Thanks,
EricAny luck anyone?
Maybe you are looking for
-
Error on uploading app for App Store submission
Hi all, We're trying to upload a new version of our app - an update - but we keep getting errors which are very odd. The Application Loader app informs us that we're trying to access the UDID through the app and using non-public APIs. Both of which w
-
Drag and drop problem on Lion... doesn't work
Hi, I have had a drag and drop problem since I installed Lion on my computer. I grab a file and by the time i try to drop it on a folder it is not released. This happens in all programs and it is really annoying, finder, iphoto, mail, you name it.
-
Are "Back to my MAC" and "Port Forwarding" mutually exclusive?
I have been using APExtreme and Port Forwarding successfully for several weeks now. The PF is to allow access to game players on a PC which acts as a server on the web. All Good. One more thing, I have a ISP provided wireless modem/router to talk to
-
Firefox frequently 'not responding' having auto-installed version 10 yesterday. No previous problems. Have disabled all plugins and uninstalled and then re-installed Firefox several times today. Problem persists making continued use of this browser v
-
Hi everybody, I m new in developing web service. I am using NetBeans IDE 4.1 EA2 for developing web service. I have created a sample jaxrpc web service. When i build project it gives me error that:taskdef class com.sun.xml.rpc.tools.ant.Wscompile can