A Flash Developer Resource Site

Results 1 to 7 of 7

Thread: Help with linking

  1. #1
    Junior Member
    Join Date
    Jan 2010
    Posts
    12

    Smile Help with linking

    Hi

    i have this code of 3d carousel but i wanna link (exernal each of the icons i dont know how

    can someone help me?

    Here's the code

    import mx.utils.Delegate;

    var numOfItems:Number;
    var radiusX:Number = 300;
    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 = 5;

    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("icons.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;
    }

  2. #2
    Senior Member
    Join Date
    Dec 2009
    Posts
    109
    Here is the AS 2.0 code:

    googleButton.onRelease = function(){
    getURL("http://www.google.com");
    }

    The "http://" is necessary, if you don't have it there it will look for Google within your computer and not the internet.
    Syntax Error

  3. #3
    Junior Member
    Join Date
    Jan 2010
    Posts
    12
    Quote Originally Posted by Adamkyler View Post
    Here is the AS 2.0 code:

    googleButton.onRelease = function(){
    getURL("http://www.google.com");
    }

    The "http://" is necessary, if you don't have it there it will look for Google within your computer and not the internet.
    thanks

    but where i have to put this code

    and what "googleButton" has to do with this?

  4. #4
    Senior Member
    Join Date
    Dec 2009
    Posts
    109
    "googleButton" is just an example of a buttons name. You need to change it to match your MC's name. You can put the code at the beginning of the main time line at the end of all the other code.
    Syntax Error

  5. #5
    Junior Member
    Join Date
    Jan 2010
    Posts
    12
    Quote Originally Posted by Adamkyler View Post
    "googleButton" is just an example of a buttons name. You need to change it to match your MC's name. You can put the code at the beginning of the main time line at the end of all the other code.
    unfortunately it desont work

    one of my file names in the "icons.xml" is uAlbums

    here's the code i put
    Look at the end

    And by the way i cant put the links in an xml file?
    if yes can you pleaseeee help me??

    Thanks alot


    import mx.utils.Delegate;

    var numOfItems:Number;
    var radiusX:Number = 300;
    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 = 5;

    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("icons.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;
    }

    uAlbums.onRelease = function(){
    getURL("http://www.google.com");
    }

  6. #6
    Senior Member
    Join Date
    Aug 2000
    Location
    Montréal
    Posts
    14,141
    function released()
    {
    //actions
    }

    this would be a good place to call the URLs.

    add this in the for loop:
    t.myURLS = nodes[i].attributes.myURLS;

    and enter your URLS in the xml like you entered the toolText of your tooltips.

    gparis

  7. #7
    Junior Member
    Join Date
    Jan 2010
    Posts
    12
    Quote Originally Posted by gparis View Post
    function released()
    {
    //actions
    }

    this would be a good place to call the URLs.

    add this in the for loop:
    t.myURLS = nodes[i].attributes.myURLS;

    and enter your URLS in the xml like you entered the toolText of your tooltips.

    gparis
    ooo

    thank youuuuuuu

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center