Code for a swf hotspot

Hey there. I wanted to make a swf as an interactive hotspot. I managed to get it working by replacing the private function hotspot in panosalado.as. The only problem Ive run into so far is the onClick in the XML doesnt work, so you cant use it to "loadspace". Is this an easy fix? I havent been able to figure it out. Heres the code I used:

 private function hotspot(xml:XML):Hotspot
        {
        var bmd:MovieClip = bulkLoader.getMovieClip(xml.file.toString(), false);
                       
        var width:Number = bmd.width * 40;
                       
        var height:Number = bmd.height * 40;
                       
        width = int( xml.@width) * 40 || width ;
                       
        height = int( xml.@height) * 40 || height ;
                       
        trace("WIDTH = "+width+" HEIGHT = "+height);
                       
        var material:MovieMaterial = new MovieMaterial(bmd, true);
                       
        material.interactive = StringTo.bool( xml.@interactive) || true ;
                       
        material.animated = true;
                       
        var segments:int = int( xml.@segments) || 3 ;
                       
        var pan:Number = Number( xml.@pan) || 0 ;
                       
        var tilt:Number = Number( xml.@tilt) || 0 ;
                       
                trace("pan = "+pan+" tilt = "+tilt);
                               
                       
        var hs:Hotspot = new Hotspot(pan, tilt, material, width, height, segments, segments );
                       
        return hs;
                }

Wow

Hey that is fantastic! I'm going to have to put that into the next release with your name on it.

Thank you.

I'd completely forgotten about bulkloader being able to fetch a MovieClip out of a loaded file.

As for mouse events, because of how papervision has to display a 2D movieclip in 3D, all the mouse events are gone. You are effectively looking at a "snapshot" of the actual movieclip. However, you shouldn't have any troubles putting a papervision "mouse event" on the movieclip as a whole, or putting an onClick function in the XML (which is really a PV "mouse event").

Again, thank you, And if you'd like your real name on the contribution, just drop me an email.

Zephyr Renner

__________________

Zephyr Renner

sweet

glad I could help. Smile I should be thanking you for this awesome piece of software.

For mouse events they do seem to work for me when they are in the hotspot swf. I'm using roll over and click events to trigger things in the hotspot.

I tried using the onClick event in the XML as it is in your example, like onClick="loadSpace:pano2". It works fine for bitmap hotspots but doesnt seem to like movieclips. Im guessing the InteractiveScene3DEvent.OBJECT_CLICK in panosalado.as is the PPV mouse event you're talking about? I read the documentation for it at papervision's site and it seems like it should work...but I have never worked with papervision before...

Any ideas? Maybe I could call the loadSpace function from my hotspot swf using MouseEvent.CLICK? Would that be possible?

ugh...Im still stuck on

ugh...Im still stuck on this. Could you explain what you mean by putting a papervision event on the movieclip as a whole? how I would go about doing this? Thanks man.

Clicks on SWF Hotspots

hmmm....

Well, just putting onClick="..." in the XML will put a papervision InteractiveScene3D listener on the hotspot.

Or code like this:

primitive.addEventListener(InteractiveScene3DEvent.OBJECT_CLICK, interactionScene3DEventHandler, false, 0, true);

I am not sure why it is not working for you. I am going to incorporate your code into PanoSalado later this afternoon, and maybe I can find the error.

DO you have the hotspot set to interactive in the XML? And do you have the viewport set to interactive also?

If you don't have interactive set on both, the event won't fire. That might just be the problem.

Zephyr

__________________

Zephyr Renner

How would you set the

How would you set the VIEWPORT to interactive? I didnt see that anywhere in the documentation...I didnt have the HOTSPOT set to interactive but it didnt seem to do anything when I put it in. Heres my hotspot code:

<hotspot id="more"
        interactive="true"
        useHandCursor="true"
        pan="265"
        tilt="0"
        segments="8"
        oneSide="false"
        onClick="loadSpace:s07">

        <file>more.swf</file>
                                       
        </hotspot>

and then it goes to

<space id="s07"
        label="s07"
        interactive="true"
        segments="8"
        transition="tween:currentSpace.viewport.alpha from 0 over 1.5 seconds using Expo.easeIn;"
                                       
        onTransitionEnd="removeLastSpace;"
        smoothOnAcceleration="false"
        >

                               
        <cube id="2007">
etc....

Yeah, let me know if you can get the hotspot swf onclick to work! Thank you :]

Re: SWF hotspots

To set interactive on the viewport you set interactive="true" in the particular space tag.

So:

<space  .... interactive="true" .... >
      <hotspot ... interactive="true" ...>
      ....
      </hotspot>
</space>
__________________

Zephyr Renner

anything yet?

hey, did you find what was wrong yet? sorry if I'm being annoying Big Grin I know youre probably busy with other stuff. but yeah my space and hotspot interactive are both set to true.

clicks on swf hotspots in panosalado (space=interactive, etc)

Hey aeroshock --

Do you have a link to an example online? That could be most helpful...

Cheers,

Patrick

__________________

Patrick Cheatham
FlashPanos.com creator, Panoramic Photographer
Got PanoSalado?

sure. its at

sure. its at http://goodnessclothing.com/new.html

The part that says "for more shirts check out the 2007 line" is the one that should be loading the new pano.

Gracias
Ryan

re: SWF hotspot click in PanoSalado

aeroshock wrote:

The part that says "for more shirts check out the 2007 line" is the one that should be loading the new pano.

Hey Ryan -- that's a really cool use for a pano/PanoSalado. Neat! Radiohead is my fave... Smile

What happens when you set the hotspot in question with  interactive="true"?

Cheers,

Patrick

[edit: be sure to post a link for us when the project goes live!]

__________________

Patrick Cheatham
FlashPanos.com creator, Panoramic Photographer
Got PanoSalado?

Why thank you...I'll def let

Why thank you...I'll def. let you know when its up. Setting the interactive="true" on the hotspot doesnt seem to change anything. I mustve broken something with my new hotspot code Sad

Would I be able to manually call the loadSpace function, like outside of the XML? I was thinking maybe just put the event listener right in my swf hotspot.

EDIT: not sure if this will help, but I think it has something to do with the problem. I noticed that theres some quirky behavior with using swfs as hotspots. Im not sure exactly whats going on but it seemed like the pano was removing the parent container from the hotspot.

For example: in the swf hotspot I have a parent mc and child mc. Basically you hover over the parent clip which adds the child clip, and then you can hover on the child. In my pano the events I wrote in the hotspot werent working right. I would hover over the child and it would think I wasnt on the parent anymore. In panosalado it seems to think once I mouse over the child, I am no longer mousing over its parent.

Innnnnnn conclusion, I wouldnt be surprised if this is why its not sensing a click on the hotspot.

re: SWF hotspot click in PanoSalado

Hmmm...

Well, if you don't use the child movie clip, do you get better results?

Also, what happens when applying "buttonMode=true" to either the XML, or to your swf hotspot Actionscript?

--
Regarding calling loadSpace from another SWF... Yes! Check out the UserInterface.as which is in the downloads... You can tell PS to execute just about anything you want.

Cheers,

Patrick

__________________

Patrick Cheatham
FlashPanos.com creator, Panoramic Photographer
Got PanoSalado?

ahhh indeed, I was able to

ahhh indeed, I was able to call loadSpace from UserInterface using panoSalado.execute("loadSpace:preview2;");.

I will have to just add a link from userinterface. Thanks a lot for your help. That allowed me to have just made a new thread about communicating from a hotspot to a layer. Hooray, questions!