-
3D Carousel and problem witch clickable images
Hi Everyone
I have a big problem. I dont know nothing about AS (maybe a littlebit), but every methot where I want to do carousel was bad so I decidet to AS
I have code form examples and I change it to my project, can be viewed on http://foto-korn.pl/
And the code
Code:
import mx.utils.Delegate;
import mx.transitions.Tween;
import mx.transitions.easing.*;
var numOfItems:Number;
var radiusX:Number = 400;
var radiusY:Number = 60;
var centerX:Number = 640;
var centerY:Number = 280;
var speed:Number = 0.0;
var perspective:Number = 140;
var home:MovieClip = this;
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.content = nodes[i].attributes.content;
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;
}
}
xml.load("icons.xml");
function mover()
{
this._x = Math.cos(this.angle) * radiusX + centerX - 200;
this._y = Math.sin(this.angle) * radiusY + centerY - 30;
var s = (this._y - perspective) /(centerY+radiusY-perspective);
this._xscale = this._yscale = s*70;
this.angle += this._parent.speed;
this.swapDepths(Math.round(this._xscale));
}
this.onMouseMove = function()
{
speed = (this._xmouse-centerX)/60500;
}
function released()
{
}
function over()
{
}
function out()
{
}
My question is... How to make this images clickable to the URL from my XML file, using released function ?
I'm beggin
-
.
Hi,
Try adding the red lines
t.icon.inner.loadMovie(nodes[i].attributes.image);
t.imageToGet = String(nodes[i].attributes.image);
t.r.inner.loadMovie(nodes[i].attributes.image);
and then this
function released()
{
getURL(this.imageToGet, "_blank");
}
-
Its working but the opened page is weard "file:///E|/backup/foto-korn/moje/carousel3/undefined" even when I put "http://google.pl/"
But now I can make variable from XML right ? and will be working ?
-
.
Hi,
Yes, you can do it through the xml, I thought you already had with the code you supplied.
We haven't see your xml file yet.
-
Was in the code, but was very complicated cause it was not a link. Code get the text from variable and display it
XML file is simple
But when I trying to get the "content" variable it doesnt work
<icons>
<icon image="1.png" tooltip="LimeWire" content="http://google.pl/" />
<icon image="2.png" tooltip="Rubik's Cube" content="http://google.pl/" />
<icon image="3.png" tooltip="Widgets" content="http://google.pl/" />
<icon image="4.png" tooltip="Trash Can" content="http://google.pl/" />
<icon image="5.png" tooltip="Compass" content="http://google.pl/" />
<icon image="6.png" tooltip="Toaster" content="http://google.pl/" />
<icon image="7.png" tooltip="Can of SPAM" content="http://google.pl/" />
<icon image="8.png" tooltip="Apple iMac" content="http://google.pl/" />
<icon image="9.png" tooltip="Apple iPod" content="http://google.pl/" />
<icon image="1010.png" tooltip="Terminal Window" content="http://google.pl/" />
<icon image="1111.png" tooltip="Terminal Window" content="http://google.pl/" />
</icons>
-
.
Hi,
It is a scope issue, try
PHP Code:
function released() { trace(this._parent.imageToGet); getURL(this._parent.imageToGet, "_blank"); }
it's not content we are trying to load, it is image (nodes[i].attributes.image)
-
ok i think im starting understand a littlebit
So in nodes[i].attributes.(name of variable) I will have the String from XML ?
In this case my link is in "content" variable
if t = home.attachMovie("item","item"+i,i+1);
then in t.content = nodes[i].attributes.content; i have my string ? right ?
but I dont know how to get this link from that variable and put it to GetUrl function
Maybe its possible to direct this variable to released function and put it to GetUrl
I tried many thinks something like function released(e:Event) and in t.icon.onRelease = released(nodes[i].attributes.content);
Then (in my thinking way) I have e.content as my link ?
Wrrrrrr its so weard
-
.
Hi,
OK, lets get things correct.
What do you want to load when you click the image? a large image in a balnk page or the http:// link in a blank page?
then attach your *.fla and xml file so we can fix things
-
.
Hi,
I looked at your site again, it seems you have fixed the image linking to an extent, I think you should, open the image in a blank window, but its your choice, it's very memory hogging, I dont understand this in your code as it seems you dont use it or load something twice.
t.content = nodes[i].attributes.content;// dont see where on the site, or what http://google.pl has to do with it
t.icon.inner.loadMovie(nodes[i].attributes.image);// ? one is the image
t.r.inner.loadMovie(nodes[i].attributes.image);// ? one is the image
probably only need one of them but its hard to say without seeing your file
-
Hi
really thanks so much for you answers (and i dont care about memory hogging in this project :P )
My idea is to make this images clickable to external link from this page
I made gallerys and every image should going to specified gallery (top menu)
t.content was from the code from start (everything was examle)
And the content displayed text (from XML) when i clicked to image
im attaching fla.... xml file is the same like i paste teh code
carousel3.fla
-
.
Hi,
I'm not sure what version of Flash you use, here is a file for you, it is CS5, as low as I can save.
http://fruitbeard.net/uploaded/carousel.zip
at present the content and tootip inside the xml are not being used, I left it there for later use perhaps.
-
i opened swf file and when im clicking on image its direct to image in browser (like before)
but im dowloading cs5 right now so i will see :P
-
.
HI,
Oh so you want it to open inside the swf in a new movieclip, you didn't specify that
-
hmmm not movieclip
ok Maybe i will explain again
http://foto-korn.pl/
I want to make direct from images to specified link... in this case link from menu above
By clickin on image I want bo directed to example http://foto-korn.pl/index.php/armi-krajowej
And every image should be directed to other gallery (link)
-
.
Last edited by fruitbeard; 11-15-2014 at 10:57 AM.
-
-
.
Yes it will be in the xml read the above post, you only have 7 pages, there are eleven in the xml.
Here you go, you can alter the xml yourself
http://fruitbeard.net/uploaded/newCarousel.zip
Last edited by fruitbeard; 11-15-2014 at 11:15 AM.
-
Hi
Thanks is working perfect
What version of flash are you usung
I installed Flash CS newest version and is error about actionscript
Can you save this fla file in better version ?
-
.
Hi,
I use Flash CS6, so the answer is no to saving as a higher format.
What does the error code say, you can find out how to correct it if you look it up.
Post the error code, as I have no error here.
Last edited by fruitbeard; 11-17-2014 at 02:40 PM.
-
Hi
The error says that the actionscript 2.0 is not supported in this version so publishing will be set to actionscript 3.0
And the whole code of old AC will be deleted
The TIP from them is to convert all code to AC 3 before publishing
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|