SWF messenger loading external flash file - changing paths

Working with Media (graphics, audio, video) & other Assets

Moderator: Nav

SWF messenger loading external flash file - changing paths

Postby monmouthrider » Wed Apr 27, 2011 6:52 am

Hi Nav, I working on another idea for an interaction.

This time there is a graphic on the stage (wider than the stage) which scrolls left and right when the learner moves the mouse left/right. There will be various clickable icons placed over and around the main graphic which appear as the graphic scrolls, these will trigger something to happen in Smartbuilder.

The idea was to have the scrolling graphic and icons in an external swf which is loaded via swf messenger. Clicking an icon fires an event to Smartbuilder to trigger an info box , questions etc.

I have obtained (purchased) a fla which has the basic actionscript for the scrolling swf and icons which trigger a trace. Its actually a 'menu style' animation/navigation however the basic idea can be changed into part of an explore interaction where learners have to spot key items in a scene. I'm sure you have seen the sort of thing.

As with my 'Spin the wheel' interaction the original swf works fine standalone however the paths have to be changed to work within Smartbuilder as they contain '_root' etc. I have tried to change the code to embed into Smartbuilder using the knowledge gained from the 'Spin the wheel' solution but can't get it working at all.

Would it be possible for you (or a developer) to have a look at the code paths in the original .fla which is attached. None of my coding attempts are worth looking at. The middle four icons have a trace where I would put the fireEvents. The far left and right icons perform internal actions which are not really relevant but it would be nice to keep the option.

It looks like it should be easier than Spin the wheel but I still can't work out the correct path changes.

Regards

Trevor
Attachments

Int-131a__Panorama_Frame-Menu_MX04.fla [ 227.5 KiB | Viewed 14237 times ]

monmouthrider
 
Posts: 30
Joined: Fri Mar 04, 2011 8:36 am

Re: SWF messenger loading external flash file - changing paths

Postby ffox » Sat Apr 30, 2011 9:18 am

Hi Trevor,

Nav had me look into this for you. This is what I found:

1. It's ok to use _root. It will point to your SWF's root and not SuddenlySmart's. We set the _lockroot property each time we load external SWFs.
2. SmartBuilder uses the first frame of Movies to determine its size. Its recommended to use the first frame as the bounding box you want to use for your entire Movie. In your case, you have a mask region that is very large. This should be placed on the 2nd frame with a stop() command.
3. It is recommended all SWFs used in SmartBuilder be compiled to Flash 8. Your movie is compiled to Flash 6. The key differences / issues I saw with your Movie had to do with case sensitivity. hittest needs to be renamed to hitTest (line 18), and onEnterframe to onEnterFrame (line 38)
4. You were using "Stage.width" (line 5 and line 8 ). This will use SmartBuilder's Authoring or Player window size. I believe your intention was to use your Movie's size not the Stage's. If that's the case then you should change these lines to the Bounding Box size you set in frame 1.

I have attached a version of your file with the changes mentioned above.

NOTE: When SmartBuilder loads a Movie in Authoring mode it stops the SWF on the 1st frame.

I have included an example of how you might use this first frame with SmartBuilder. I have added a preview image to this 1st frame by taking a static snapshot of your 2nd frame interaction; This will be shown in Authoring mode when your Movie is added to the authoring stage. In run-time mode, SmartBuilder plays the Movie. In your case, it will stop on frame 2 where your interaction is.
Attachments

Int-131a__Panorama_Frame-Menu_Flash8_V2.fla [ 492.5 KiB | Viewed 14225 times ]

ffox
 
Posts: 4
Joined: Fri Jun 29, 2007 1:09 pm

Re: SWF messenger loading external flash file - changing paths

Postby ffox » Sat Apr 30, 2011 9:52 am

One more code change: Whenever you call hitTest it is expecting the mouse coordinates passed in to be transformed to the Main stage.

I changed:

hitTest(_xmouse, _ymouse, true)

To:

hitTest(_level0._xmouse, _level0._ymouse, true)
ffox
 
Posts: 4
Joined: Fri Jun 29, 2007 1:09 pm

Re: SWF messenger loading external flash file - changing paths

Postby monmouthrider » Mon May 02, 2011 1:52 am

Hi, thanks very much for making the changes to the fla and the detailed notes. This has really helped with my understanding of embedding swf files.

I have found one small issue with the file you returned. In the standalone version the background image stops scrolling left or right once it is at the far edge of the image. However once embedded and previewed in smartbuilder or published/downloaded the scrolling continues left or right beyond the end of the image. I have looked at the code but can't find the problem.

Regards

Trevor
monmouthrider
 
Posts: 30
Joined: Fri Mar 04, 2011 8:36 am

Re: SWF messenger loading external flash file - changing paths

Postby monmouthrider » Tue May 03, 2011 8:44 am

Hi Nav,

Sorry to be a real pain one more thing in addition to my last reply on stopping the scrolling. Whilst waiting for the new artwork for the scrolling background I have added some 'fireEvent' code to the 'V2' demo version of the fla to trigger events inside smartbuilder to make sure they were working.

I have put the code to fire a trigger on the middle four icons but I can't trigger anything inside smartbuilder. I have attached the fla which has '_TWM' at the end of your V2 fla.

Regards

Trevor
Attachments

Int-131a__Panorama_Frame-Menu_Flash8_V2_TWM.fla [ 464 KiB | Viewed 14215 times ]

monmouthrider
 
Posts: 30
Joined: Fri Mar 04, 2011 8:36 am

Re: SWF messenger loading external flash file - changing paths

Postby monmouthrider » Wed May 04, 2011 3:57 am

Hi Nav,

I have fixed my last request i.e. triggers not working. The various function calls were not on the main timeline. I added an _root to my function calls and they work. I'm getting to understand when _root can and can't be used. So I only have the previous thread regarding stopping the scroll background at the edges outstanding.

Regards
Trevor
monmouthrider
 
Posts: 30
Joined: Fri Mar 04, 2011 8:36 am

Re: SWF messenger loading external flash file - changing paths

Postby Nav » Wed May 04, 2011 9:28 am

Hi Trevor,
At this point you probably know more about ActionScript than I do. I'll see if I can get the developer that answered your previous question to look at it again. A stop-gap solution that I might suggest is to mask the areas that you don't want seen with a SmartBuilder shape or a graphic.

- Nav
Nav
 
Posts: 866
Joined: Mon Nov 05, 2007 2:58 pm

Re: SWF messenger loading external flash file - changing paths

Postby ffox » Thu May 05, 2011 6:50 am

When running stand alone the _root._xmouse never drops below 0 and never greater than the width of the movie. When the SWF is loaded in SmartBuilder the _xmouse value goes outside this range and causes it to scroll more than you want.

You can add an if statement in the "_root.onMouseMove=function() {" block to check the xmouse bounds; such as:

if(_root._xmouse > 0 && _root._xmouse < LOCAL_MOVIE_WIDTH) {

...

}
ffox
 
Posts: 4
Joined: Fri Jun 29, 2007 1:09 pm

Re: SWF messenger loading external flash file - changing paths

Postby monmouthrider » Thu May 05, 2011 8:36 am

Hi Frank, Nav,

Thanks for the extra bit of code, worked first time.

Cheers

Trevor
monmouthrider
 
Posts: 30
Joined: Fri Mar 04, 2011 8:36 am


Return to Media & Assets

Who is online

Users browsing this forum: No registered users and 1 guest

cron
Not able to open ./cache/data_global.php