User |
Post |
2:14 am
April 30, 2009
|
eddaros
Member
|
|
|
|
|
posts 3
|
|
|
How can I assign functions to individual pictures? Not linking outside the file but making some movieclip do something.
|
|
4:05 am
April 30, 2009
|
smonte
Admin
|
|
|
|
|
posts 27
|
|
|
Post edited 11:06 am – April 30, 2009 by smonte
Post edited 1:18 pm – May 11, 2009 by smonte
Hey,
Hmm, one way to do it is to specify in the XML file / movie clip an XML item should load. So instead of having the “link_to” node in the XML you could have a “movie_clip” node. Then in the imageClicked() function you check which item was clicked…
function imageClicked(e:Event):void {
if (e.target.movie_clip == “home”) {
//ADD YOUR CODE HERE (e.g. load an image or animate some movie clip etc.)
}
}
Hope this gets you started!
Regards,
smonte
|
|
|
7:32 am
May 1, 2009
|
eddaros
Member
|
|
|
|
|
posts 3
|
|
|
Thank you this is definitely the help I needed
|
|
3:44 am
May 11, 2009
|
eddaros
Member
|
|
|
|
|
posts 3
|
|
|
Ok there is something that I am not getting. How do I specify in the xml file that a certain picture should trigger a certain function?
I tried this
prod1.png
home
instead of this
prod1.png
http://wikipedia.org
and then the function that you suggested and it does not work. If I place a trace inside the function it will work if it is outside the if statement but not inside it so there is something wrong with they way I am either writing the xml or in if statement.
Needless to say I am not very experienced using xml and as3 together
|
|
6:24 am
May 11, 2009
|
smonte
Admin
|
|
|
|
|
posts 27
|
|
|
Hey,
Your XML file looks ok. So now in the loadImages() function you should give each imageHolder a “movie_clip” variable like this (in the for each loop where we create the image holders):
imageHolder.movie_clip = image.movie_clip;
And then in the imageClicked() function you check which button was clicked.
function imageClicked(e:Event):void {
if (e.target.movie_clip == “home”) {
//ADD YOUR CODE HERE (e.g. load an image or animate some movie clip etc.)
}
}
Hope this helped!
Regards,
smonte
|
|
|
11:28 pm
May 26, 2009
|
Hair
New Member
|
|
|
|
|
posts 2
|
|
|
Post edited 6:51 am – May 27, 2009 by Hair
Hi, I'm new to this AS3 thing…
I tried copying and typing the codes you did, now my question is how do I center the carousel on to the window?
This is because my window size is different from the tutorial, it's 300×539. When I tested it, it's too far off.
Thank you
ps
Do I have to upload the gs folder together with the swf?
|
|
12:02 am
May 28, 2009
|
Hair
New Member
|
|
|
|
|
posts 2
|
|
|
What version is this anyway? I can't open the file, I'm using Flash CS3.
|
|
11:43 am
June 13, 2009
|
ozfozzie
New Member
|
|
|
|
|
posts 1
|
|
|
Post edited 6:44 pm – June 13, 2009 by ozfozzie
Post edited 1:20 pm – June 14, 2009 by ozfozzie
Hi
I am trying to load the images from my harddrive rather than a url but i dont seem to be able to get the pictures to display….. Im probably doing something wrong in the xml or the actionscripting codes. heres the xml:
7
C:\Documents and Settings\Owner\My Documents\Buttons\NEWS.ai
http://hellesdonandsprowstonbrass.co.uk/news.htm
C:\Documents and Settings\Owner\My Documents\Buttons\PHOTOS.ai
http://hellesdonandsprowstonbrass.co.uk/new_page_2.htm
C:\Documents and Settings\Owner\My Documents\Buttons\MEMBERS.ai
http://hellesdonandsprowstonbrass.co.uk/new_page_1.htm
C:\Documents and Settings\Owner\My Documents\Buttons\CONTACTS.ai
http://hellesdonandsprowstonbrass.co.uk/new_page_4.htm
C:\Documents and Settings\Owner\My Documents\Buttons\CALENDAR.ai
http://hellesdonandsprowstonbrass.co.uk/calender.htm
C:\Documents and Settings\Owner\My Documents\Buttons\VACANCIES.ai
http://hellesdonandsprowstonbrass.co.uk/vacancies.htm
C:\Documents and Settings\Owner\My Documents\Buttons\HOME.ai
http://hellesdonandsprowstonbrass.co.uk
C:\Documents and Settings\Owner\My Documents\Buttons\LINKS.ai
http://hellesdonandsprowstonbrass.co.uk/external_links.htm
I have a feeling its something to do with the bits and line 86/7 in the actionscript, howver i cant figure out what the problem is… tell me if you need the actionscript aswell
thanks in adv
ozfozzie
|
|
2:12 am
June 18, 2009
|
Devan Nair
New Member
|
|
|
|
|
posts 1
|
|
|
This is really good, can you Smonte, tell me how to adjust the location of the 3D Carousel on screen?
regards
Devan
smonte said:
Post edited 4:06 am – April 30, 2009 by smonte
Post edited 6:18 am – May 11, 2009 by smonte
Hey,
Hmm, one way to do it is to specify in the XML file / movie clip an XML item should load. So instead of having the “link_to” node in the XML you could have a “movie_clip” node. Then in the imageClicked() function you check which item was clicked…
function imageClicked(e:Event):void {
if (e.target.movie_clip == “home”) {
//ADD YOUR CODE HERE (e.g. load an image or animate some movie clip etc.)
}
}
Hope this gets you started!
Regards,
smonte
|
|
1:27 pm
June 19, 2009
|
damonlee
Member
|
|
|
|
|
posts 3
|
|
|
Post edited 8:30 pm – June 19, 2009 by damonlee
Post edited 8:42 pm – June 19, 2009 by damonlee
I too am trying to add my own functionality to the buttons.
When I add
imageHolder.movie_clip = image.movie_clip;
to the for each loop in the loadImages() function, I get the error:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at menu2_fla::MainTimeline/loadImages()
at menu2_fla::MainTimeline/xmlLoaded()
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at flash.net::URLLoader/onComplete()
So the syntax isn't right…Any help would be appreciated…
|
|
1:45 pm
June 19, 2009
|
damonlee
Member
|
|
|
|
|
posts 3
|
|
|
I found the problem…
imageHolder.movie_clip = image.movie_clip;
has to be placed after
imageHolder.addChild(imageLoader);
Thank you for pointing me in the right direction
|
|
2:17 pm
June 19, 2009
|
damonlee
Member
|
|
|
|
|
posts 3
|
|
|
One more problem,
I'm placing the carousel in my .fla flile that has a moving background, for some reason, the background is over the carousel, and it's not a layer order problem…how do I move the carousel to the top? I think it has something to do with addChildAt()
|
|
2:45 pm
June 23, 2009
|
madfatter
Member
|
|
|
|
|
posts 3
|
|
|
Similar to the background being over the carousel problem. I'm wondering if it's possible to put an object in the center of the carousel that the images move around? I assume it would need to be added dynamically and somehow monitored to know when an object should be in front of it or behind it.
This is probably beyond the scope of the tutorial but I figured I'd ask on the off chance that someone knows how to modify it in this fashion.
Thanks for any advice.
|
|
2:53 pm
July 21, 2009
|
madfatter
Member
|
|
|
|
|
posts 3
|
|
|
Hi. I was wondering how you'd remove the elements of the carousel from the stage? I'm trying to make the carousel disappear when I load new content onto the stage. I tried running through a loop that removedChildAt() enough times but it only clears some of them and then starts clearing other items on the stage and not the menu items. I think the problem lies in the part of the code that adds new child indexes as the carousel rotates. I can't figure out how to find out what those indices are.
Any advice would be greatly appreciated.
Thank you.
|
|
2:55 pm
July 21, 2009
|
madfatter
Member
|
|
|
|
|
posts 3
|
|
|
damonlee said:
One more problem,
I'm placing the carousel in my .fla flile that has a moving background, for some reason, the background is over the carousel, and it's not a layer order problem…how do I move the carousel to the top? I think it has something to do with addChildAt()
Did you figure this out? I found that by adding the element using stage.addChildAt(MovieClip, 0); the MovieClip appeared under the carousel.
|
|
8:29 am
November 4, 2009
|
kyklos
New Member
|
|
|
|
|
posts 1
|
|
|
Thanks for a great tutorial, you don't know how long i've been searching for a well written AS3 example of a carousel.
I've attempted to recreate this code into an external .as file and would like to manipulate it so its shown different times and having it draw its documents from a different .xml file each time depending on where you are on the site.
Is there a way I can do this dynamically? Such as pass into it a dynamic String variable for the xml url?
Also I seem to be running into this problem for every item on the carousel when it is moused-over and I can't figure why?:
ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.
at flash.display::DisplayObjectContainer/setChildIndex()
at navigation/sortZ()
at navigation/rotateCarousel()
Thank you.
|
|