Page 1 of 1

SWF messenger - FireEvent triggers in swf

PostPosted: Fri Apr 01, 2011 8:34 am
by monmouthrider
Nav,

I'm working on a wheel of fortune type game. I have built the spinning wheel in Flash and placed it on the stage inside a swf messenger, its working fine. Once the wheel has been clicked/spun the swf should sent one of six 'fireEvent's to Smartbuilder. I have put the six fireEvents inside the 'whatHit' function but I can't trigger anything inside the topic using actions. There is a trace output on the swf and everything looks OK (remove comments //).

I have also moved the fireEvents to frame 2 as I read something about them not working on frame 1.

I've used the swf messenger before for comms in and out and had no problems.

Could you look at the Wheel of Fortune topic (in Trevor White-Miller LGF) and the attached .fla and see what I'm doing wrong. These are just the cut down rough tests for a bigger game.

Trevor

Re: SWF messenger - FireEvent triggers in swf

PostPosted: Thu Apr 07, 2011 10:59 am
by Nav
Hi Trevor,
So I had to give this over to one of our developers because the problem was beyond me. But he fixed it, and said this. Since this SWF is being loaded into SmartBuilder, which is a bigger SWF, your SWF needs to be designed to work in that framework from an AS perspective. Not that you explicitly used calls like _root, but some of Flash's default references got in your way.

  • You can use mx.utils.Delegate to preserve scope with function calls.
  • You need to perform hitTest with values transformed to the root or global.
Please find the corrected (though still with debugging functionality) FLA attached.

Also, this is a pretty handy little piece of functionality. Do you mind if we genericize it and make it available to the rest of the SmartBuilder community?

- Nav

Re: SWF messenger - FireEvent triggers in swf

PostPosted: Thu Apr 07, 2011 1:47 pm
by monmouthrider
Hi Nav, Many thanks for the fix, please pass my thanks to the SB developer as well. Quickly loaded it in and working fine.

Apart from being able to complete the design of the game interaction it has been a good exercise in understanding more about using the swf messenger with embedded flash files. I knew to avoid '_root' but was not sure how to reference up to the main smartbuilder swf.

Please feel free to use the code/concept in the community as required. The only restriction is the artwork of the spinning wheel which was cropped out of something else which I don't own. I was using this as a quick place holder to work on my actionscript. I'll be designing my own wheel with different categories. I think I can reuse the basic idea in a number of different ways.

Once again many thanks for the support, I'll be able to deliver the game I promised the client.

Trevor

Re: SWF messenger - FireEvent triggers in swf

PostPosted: Thu Apr 07, 2011 4:04 pm
by Nav
Thank for the trade, Trevor. Yeah, when we go to use this, we'll definitely swap out the graphic with something else.

- Nav

Not able to open ./cache/data_global.php