The Code Kingdom

viva la programmers!

Skip to content

Code for fps.swf?

Get help and support for Hikari

Code for fps.swf?

Postby sjcomp » Thu May 06, 2010 8:46 pm

Hello,

I created my application and I followed HikariDemo to add Hikari Manager. I successfully added fps.swf and control.swf to my application. Now I am trying to design my own flash file and export a function from it. I started by attempting to reproduce fps.swf. I found example in Ogre forums. But I get exception when I try to call the function.

Here is my code for fps.swf.

main.mxml
Code: Select all
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
    creationComplete="initFPS();"
    width="100%" height="100%">
    <mx:Script >
<![CDATA[
   import flash.external.ExternalInterface;
   public function setFPS(fps:String):void {
        fpsLabel.text = fps;
    }
   
    public function initFPS():void {
        // ExternalInterface
        ExternalInterface.addCallback("setFPS", setFPS);

        // Hide context menu
        var contextMenu : ContextMenu = new ContextMenu();
        contextMenu.hideBuiltInItems();

        // Drop shadow filter
        var f:DropShadowFilter = new DropShadowFilter(0.0,45,0xFFFFFF,.8, 4.0, 4.0,5.0, 1, false, false);
        var myFilters:Array = new Array();
        myFilters.push(f);
        fpsLabel.filters = myFilters;
    }
]]>
   </mx:Script>
    <mx:Label id="fpsLabel" styleName="style1" text="FPS" width="100%" height="100%" truncateToFit="true"/>
</mx:Application>


When I call from c++:
Code: Select all
fps->callFunction("setFPS", Hikari::Args((int)1));

I get the following exception :
Code: Select all
15:39:49: OGRE EXCEPTION(8:RuntimeAssertionException): Failed to call ActionScript function 'setFPS' from FlashControl 'FPS in FlashControl::callFunction at .\source\FlashControl.cpp (line 376)

If I use fps.swf from the HikariDemo, the call works, but with my swf file I get the exception above. It seems that I am not exporting the function interface properly. I tried to use fps:Number instead of fps:String, but it did not make any difference.

Any suggestions? Is the code for fps.swf available somewhere?

Thanks.
Regards, Alexander
User avatar
sjcomp
 
Posts: 2
Joined: Thu May 06, 2010 8:32 pm


Re: Code for fps.swf?

Postby Pencheff » Mon May 31, 2010 10:14 am

Attaching you the .fla files from the example
Attachments
fps.fla.rar
The .fla file from the hikari example
(3.81 KiB) Downloaded 14 times

Pencheff
 
Posts: 13
Joined: Wed Feb 25, 2009 2:26 pm

Re: Code for fps.swf?

Postby sjcomp » Mon May 31, 2010 4:46 pm

Thanks Pencheff, I do not have a the adobe program to read FLA, could you post the mxml and as files from the fla project?

Thanks a lot
Regards, Alexander
User avatar
sjcomp
 
Posts: 2
Joined: Thu May 06, 2010 8:32 pm


Return to Get Help

Who is online

Users browsing this forum: No registered users and 1 guest

cron