| | | Seise |  |
| Posted: Wed Sep 03, 2008 10:29 pm Post subject: Flash and XML files |  |
| |  | |
I have looked every where even here in this forum but I cant find the solution anywhere, so now I need some help.. OK, so whats the problem then? It might be easy for some but not for me because I don?t know where I shoulde put in the code...
I?ve made a 3D Carousel on a webpage that?s going to be on our Community page all the work is done but there are just one problem left, I want to be able to click on the icon in the Carousel and get to a other page somewhere but nothing happends... So if you want to help me.....
XML CODE:
<?xml version="1.0" encoding="utf-8"?> <icons> <icons image="ace.png" tooltip="Seek 4 Poker Info" url="http://www.google.com" /> </icons>
ACTION SRIPT:
import mx.utils.Delegate; import mx.transitions.Tween; import mx.transitions.easing.*;
var numOfItems:Number; var radiusX:Number = 200; 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; var home:MovieClip = this;
var tooltip:MovieClip = this.attachMovie("tooltip","tooltip",10000); tooltip._alpha = 0;
var xml:XML = new XML(); xml.ignoreWhite = true;
xml.onLoad = function() { var nodes = this.firstChild.childNodes; 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.toolText = nodes[i].attributes.tooltip; t.icon.inner.loadMovie(nodes[i].attributes.image); t.r.inner.loadMovie(nodes[i].attributes.image); t.icon.onRollOver = over; t.icon.onRollOut = out; t.icon.onRelease = released; } }
function over() { home.tooltip.tipText.text = this._parent.toolText; home.tooltip._x = this._parent._x; home.tooltip._y = this._parent._y - this._parent._height/2; home.tooltip.onEnterFrame = Delegate.create(this,moveTip); home.tooltip._alpha = 100; }
function out() { delete home.tooltip.onEnterFrame; home.tooltip._alpha = 0; }
function released() { trace(this._parent.toolText); }
function moveTip() { home.tooltip._x = this._parent._x; home.tooltip._y = this._parent._y - this._parent._height/2; }
xml.load("icon.xml");
function mover() { this._x = Math.cos(this.angle) * radiusX + centerX; this._y = Math.sin(this.angle) * radiusY + centerY; var s = (this._y - perspective) /(centerY+radiusY-perspective); 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)/2500; } |
|