×

Discussion Board

Results 1 to 11 of 11
  1. #1
    Registered User
    Join Date
    Aug 2008
    Posts
    8

    FL4 AS3 & N8 close button issues and links

    I know this is something pretty simple but it does not seem to work and I'm not really sure why. I'm trying to make the app close so I can disable the soft keys. I have called a JS function through external interface, "window.close();" and fscommand("Quit"). nothing happens. I have embedding the FL4 content in a WRT package and installing it on the phone.

    I have also noticed navigateToUrl() or calling a JS function to do "window.widget.openURL()" isn't working. Makes me think there is a security setting.

    Thanks for any help.

  2. #2
    Nokia Developer Champion
    Join Date
    Jul 2008
    Location
    Pakistan
    Posts
    1,065

    Re: FL4 AS3 & N8 close button issues and links

    Hi evilpaul,
    Since you are embedding it into WRT. So, try this getURL api :
    Code:
    getURL("javascript:window.close()");
    or
    Code:
    getURL("javascript:setInterval('window.close()', 100)");
    Moreover, make sure you export your swf under "Access Network Only" settings.
    EDIT:
    Just saw that you are asking about AS3. In AS3, it is recommended to use ExternalInterface and i think you just need to export your content under "Access Network Only" and follow the these 2 instructions written in above page to call JS functions :
    In the object tag for the SWF file in the containing HTML page, set the following parameter:
    <param name="allowScriptAccess" value="always" />
    In the SWF file, add the following ActionScript:
    flash.system.Security.allowDomain(sourceDomain)
    Best Regards,
    SajiSoft
    Last edited by sajisoft; 2010-11-29 at 19:04. Reason: Improvement & Addition

  3. #3
    Registered User
    Join Date
    Aug 2008
    Posts
    8

    Re: FL4 AS3 & N8 close button issues and links

    fscommand2 doesn't compile in AS3. Or I'm not importing the correct classes. I've tried:

    import flash.system.System;
    import flash.system.fscommand;
    import flash.system.Fscommand;

    Is there a setting in the WRT embedding HTML to allow it do this? I tried to make a simple AS2 app that just closes the app and it didn't work. Also if I run the swf from the file manager, it closes just fine. Same with my normal app. It has something to do with a embed parameter. Any ideas?

  4. #4
    Nokia Developer Champion
    Join Date
    Jul 2008
    Location
    Pakistan
    Posts
    1,065

    Re: FL4 AS3 & N8 close button issues and links

    Hi evilpaul,
    I think you overlooked my last edited post .Actually, i misunderstood your issue and thats why ask you to use fscommand2. Fscommand2 doesnt even work with AS 2 if u r embedding swf into a WRT. So, try these things :
    1- Try this actionscript for closing your application :
    Code:
    ExternalInterface.call("eval", "window.close();");
    If it doesnt work try :
    Code:
     public var u:URLRequest = new URLRequest("javascript:window.close()");
    OR try this final solution :
    -Create a function in javascript i.e inside main.html write this :
    Code:
    <script language=javascript>
    function closewindow (){
    window.close();
    }
    </script>
    and then inside Flash , write this AS :
    Code:
     ExternalInterface.call("closewindow");
    2- For security related issues, try exporting your swf under "Access Network Only" settings.
    3- Open the main HTML of your WRT and see that whether this <param name="allowScriptAccess" value="always" /> line is there? .It looks like something like this :
    Code:
    <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553548000" width="360" height="640" id="MyFlash" align="middle">
    		<param name="allowScriptAccess" value="always" />
    		<param name="movie" value="MyFlash.swf" />
    		<param name="loop" value="false" />
    		<param name="menu" value="false" />
    		<param name="quality" value="high" />
    		<param name="wmode" value="opaque" />
    		<param name="bgcolor" value="#ffffff" />
    		<embed src="MyFlash.swf" loop="false" menu="false" quality="high" wmode="opaque" bgcolor="#ffffff" width="360" height="640" name="Finish" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
    	</object>
    4- The last thing add this line in your Flash Lite code before using ExternalInterface :
    Code:
    flash.system.Security.allowDomain("*")
    According to documentation, now your widget must have to get closed and there should be no security issues .Wish u luck

    Best Regards,
    SajiSoft

  5. #5
    Registered User
    Join Date
    Aug 2008
    Posts
    8

    Re: FL4 AS3 & N8 close button issues and links

    This is very odd. I tried everything you recommended and still nothing. I am checking if ExternalInterface is available and it is. The app just does nothing. I'm going to see if I can find a example app that has a close button. Maybe it is something in my WRT html or something. I used the how to packed article on this site. I even tripled check everything you said to make sure I got everything.

  6. #6
    Registered User
    Join Date
    Aug 2008
    Posts
    8

    Re: FL4 AS3 & N8 close button issues and links

    Still no luck. I downloaded the example on this page: http://wiki.forum.nokia.com/index.ph...nt_in_a_Widget . I then made a new flash lite 4 app with the suggestions you made, packaged it using what I downloaded from that site. Nothing worked. I also tried to go to a url using all the methods you said and that did not work either.

  7. #7
    Nokia Developer Champion
    Join Date
    Jul 2008
    Location
    Pakistan
    Posts
    1,065

    Re: FL4 AS3 & N8 close button issues and links

    Hi evilpaul,
    I dont have a Symbian^3 device here but just to help you i goto RDA and do number of tests. Let me tell you the results :
    1-In AS 2 , to exit from the WRT use this actionscript :
    Code:
    getURL("javascript:window.close()");
    It works perfectly fine on N8 .
    2- In AS 3, no need to care about security measures i discussed in previous post, simply put this AS :
    Code:
     var u:URLRequest = new URLRequest("javascript:window.close()");
    navigateToURL(u);
    It is tested on N8 and working fine. Please, let me know if u r still not able to fix it . Wish u luck.

    Best Regards,
    SajiSoft

  8. #8
    Registered User
    Join Date
    Aug 2008
    Posts
    8

    Re: FL4 AS3 & N8 close button issues and links

    awesome that actually worked just fine, thanks! I do have another question, I tried to use the same method to go to a web address:

    Code:
    var u:URLRequest = new URLRequest("javascript:window.open('http://www.google.com')");
    navigateToURL(u);
    I also tried to make a JS function that would call "window.open" and neither worked. Is flash/WRT able to link out to web pages? Weird that I can do window.close but not window.open.

    Thanks again for your help.

  9. #9
    Nokia Developer Champion
    Join Date
    Jul 2008
    Location
    Pakistan
    Posts
    1,065

    Re: FL4 AS3 & N8 close button issues and links

    Hi evilpaul,
    Currently, i dont own a N8 but u can try an alternative i.e
    Code:
    var u:URLRequest = new URLRequest("javascript:widget.openURL('http://www.google.com')");
    navigateToURL(u);
    Best Regards,
    SajiSoft

  10. #10
    Registered User
    Join Date
    Aug 2008
    Posts
    8

    Re: FL4 AS3 & N8 close button issues and links

    AWESOME, it worked! Thanks a ton. I've developed flashed for quite a few years but this is the first Flash Lite app. There also doesn't seem to be a ton on info on Flash Lite 4.

    Thanks again!

  11. #11
    Nokia Developer Champion
    Join Date
    Jul 2008
    Location
    Pakistan
    Posts
    1,065

    Re: FL4 AS3 & N8 close button issues and links

    Your most welcome Good to know that u r an experienced flash developer. Wish u very best ov luck for your Flash Lite project.

    Best Regards,
    SajiSoft

Similar Threads

  1. Flash Lite 4 & N8 & TouchEvent
    By terstepki in forum [Archived] Flash Lite on Nokia Devices
    Replies: 11
    Last Post: 2010-10-30, 22:24
  2. Flash content error : 4 on clicking close button
    By elminator in forum [Archived] Flash Lite on Nokia Devices
    Replies: 2
    Last Post: 2010-10-07, 10:02

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •