Web Design and Development Forums

Problem with Flash 8 carousel and XML

This is a discussion on "Problem with Flash 8 carousel and XML" within the Flash & Multimedia Forum section. This forum, and the thread "Problem with Flash 8 carousel and XML are both part of the Design Your Website category.


Go Back   Webforumz.com > Design Your Website > Flash & Multimedia Forum

Welcome to Webforumz.com.
Register Now Register now!

Reply
 
LinkBack Thread Tools Rate Thread
Old Apr 9th, 2008, 16:12   #1 (permalink)
New Member
 
Join Date: Apr 2008
Location: USA
Posts: 2
Problem with Flash 8 carousel and XML

I made some progress with a basic spinning carousel of items (which works a treat using just shapes created within Flash 8) but seem to have hit a few issues when stepping up to grabbing images via an external XML file- I'll try and explain the problem...

Each of the carousel items needs to grab a different file (at present I'm trying to test with images but in time these will be FLV video files).

The carousel is based on the ones demo'd at www.gotoandlearn.com. I followed the second of the tutorials and have got to the point where I've created a movie clip inside a movie clip inside a movie clip (required for the carousel) and have the accompanying ActionScript working, however when I preview the SWF file I only see the "filler shape" of the innermost movie clip, not the image file (.png) that it's supposed to contain.
The three movie clips are called item (the outermost), icon (inside item) and inner (the innermost). The outermost one ("item") is the one set to "export to ActionScript".

The images are grabbed from an XML file.

The ActionScript is as follows:

Code: Select all
var numOfItems:Number; //don't declare yet as number of items will be read from XML 
var radiusX:Number = 250; 
var radiusY:Number = 75; 
var centerX:Number = Stage.width/2; 
var centerY:Number = Stage.height/2; 
var speed:Number = 0.05; 
var perspective:Number = 130; //skew the perspective so items further back are smaller 
var home:MovieClip = this; //create variable to be used inside the XML for loop later as we can't use "this" inside that loop 
var xml:XML = new XML(); 
xml.ignoreWhite = true; 
xml.onLoad = function() 
{ 
var nodes = this.firstChild.childNodes; //i.e the XML file hierarchy 
numOfItems = nodes.length; 
for (var i=0;i<numOfItems;i++) 
{ 
var t = home.attachMovie("item","item"+i,i+1); 
t.angle = i * ((Math.PI*2)/numOfItems); 
t.onEnterFrame = mover; 
t.icon.inner.loadMovie (nodes[i].attributes.image); //load the image files 
} 
} 
for (var i=0;i<numOfItems;i++) 
{ 
var t = this.attachMovie("item","item"+i,i+1); 
t.angle = i * ((Math.PI*2)/numOfItems); 
t.onEnterFrame = mover; 
} 
xml.load("icons.xml"); 
function mover () 
{ 
this._x = Math.cos(this.angle) * radiusX + centerX; 
this._y = Math.sin(this.angle) * radiusY + centerY; 
var s:Number = (this._y - perspective)/(centerY + radiusY - perspective); //add the new perspective variable to the calculation 
this._xscale = this._yscale = s * 100; 
this.angle += this._parent.speed; 
this.swapDepths(Math.round(this._xscale)+100); 
} 
this.onMouseMove = function() 
{ 
speed = (this._xmouse-centerX)/2000; 
} 
The XML file: 
<?xml version="1.0" encoding="iso-8859-1"?> 
<icons> 
<icon image="icon1.png" /> 
<icon image="icon2.png" /> 
</icons>
The XML file seems to be read (to a degree) by the ActionScript, because if I had a new "icon" item, the carousel "grows" another item accordingly (although as before, it only displays the background shape of the image "placeholder" movie clip).

Amyone got any ideas?

Last edited by saltedm8; Apr 10th, 2008 at 00:06. Reason: added [code] tags
galahad3 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Flash Carousel XML link csr500 Flash & Multimedia Forum 2 Sep 12th, 2007 15:08
Flash problem Paul in London Flash & Multimedia Forum 2 Apr 23rd, 2007 13:54
not sure if this is Flash or Java problem . . . mcvinnie Flash & Multimedia Forum 3 Aug 22nd, 2006 20:56
Carousel Menu Darren600 Flash & Multimedia Forum 0 Aug 4th, 2006 13:39
Flash Problem - Please Help! joshfolan Flash & Multimedia Forum 6 Nov 27th, 2005 19:42



Latest Updates

All Points SEO Security Advisory - CHECK YOUR SITE NOW!

Creative Coding :: February 2008

Webforumz is sponsored by: WESH UK Web Hosting
All times are GMT. The time now is 19:14.

Sleep Study Scoring :: Free Bet :: Website Templates :: Online Betting :: Bookmakers :: Funny Quotes :: Internet Recruitment Software :: Microsoft CRM Experts :: Online Casino :: Decorated Christmas Trees :: Midwife Forums :: Football Betting :: Ecommerce Software :: Web Hosting :: Football Stats :: Dry Cleaning Collection :: xtreme wales - extreme clothing :: Apuestas :: Sharepoint Consultants :: Website Optimisation :: Office Clearance London :: Sharepoint Experts :: Sports Betting :: Casino :: Website Templates :: Web Design Development India :: Online Gambling

Powered by: vBulletin Version 3.7, Copyright ©2000 - 2008, Jelsoft Enterprises Limited.
© 2003-2008 Webforumz.com : All Rights Reserved
Search Engine Friendly URLs by vBSEO 3.2.0 RC6


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59