상세 컨텐츠

본문 제목

[AS] 액션스크립트 as3 web page refresh code PLEASE HELP!!

ADOBE/ ActionScript

by AlrepondTech 2020. 9. 22. 03:22

본문

반응형

 

 

 

=================================

=================================

=================================

 

 

 

 

 

출처: http://board.flashkit.com/board/showthread.php?790235-RESOLVED-as3-web-page-refresh-code-PLEASE-HELP!!

    1. 03-05-2009, 06:07 AM#1MemberJoin DateFeb 2004Posts64
    2.  
    3. coxyladuk2001 

 [RESOLVED] as3 web page refresh code PLEASE HELP!!

    1.  
hi all,

i have a button that i want to refresh (effectively just reloading) the webpage that the swf is sitting in i have the following code so far, but my knowledge is basic and could use a hand. if anyone can help that would be great.

Code:

//start over button code and function code below startover.addEventListener(MouseEvent.CLICK, removeallFunction); function removeallFunction (event:MouseEvent):void { navigateToUrl(new URLRequest("the url"), "_self" ); }


i dont understand the url code or what should go with it. PLEASE HELP!!
    1. 03-05-2009, 09:44 AM#2Will moderate for beerJoin DateApr 2007LocationAustin, TXPosts6,801
    2.  
    3. 5TonsOfFlax 
In order to get the URL to load, you will have to either pass it in as a flashvar (search for that term for examples), or you will have to use ExternalInterface. I'd suggest the ExternalInterface route if you can.

Code:

//start over button code and function code below startover.addEventListener(MouseEvent.CLICK, removeallFunction); function removeallFunction (event:MouseEvent):void { if (ExternalInterface.available){ ExternalInterface.call("function startover(){document.location.reload()}"); } }

More or less. You may have to play with the precise syntax. Or you could actually define a javascript function in the page to reload and call that.
    1.  
    2.  
    3. 03-05-2009, 10:00 AM#3MemberJoin DateFeb 2004Posts64
    4.  
    5. coxyladuk2001 
Hi Just wanted to say a big thankyou. It seems to be working just as i had hoped.

thanks again
Junior MemberJoin DateAug 2009Posts1

 

Hey coxylakud2001, is it posible to post the whole working code for refreshing the page which you are using. 

Thanks.

 

 

 

 

=================================

=================================

=================================

 

 

 

출처: http://www.actionscript.org/forums/showthread.php3?t=179787

 

 How to refresh a webpage using AS3?
In my flash application i have a button which should reload the webpage in which the flash application resides. However i don't know the code yet to be able to refresh the webpage when the button is pressed.
Does anyone know if this is possible? If so how?
 
  #2


why do you need to refresh the page.

That is the one thing I love the most about flash, you only need to load data not the page. This idea of having flash reload the page sounds kinda counter productive.

__________________
AS3 Apex Adobe user group | Twitter | Facebook
 
  #3


I agree with GFX kinda...

but IF you need it, I guess you can use navigateToUrl to do it:

navigateToUrl(new URLRequest("the url"), "_self" );

It's just getting the URL you want to reload. You can easily get the URL of the swf object from the SWF's LoaderInfo instance. But usually the swf in some html page.

You could also use php to do it too.

__________________
www.lordofduct.com - come read my blog!

If you want to know how to program, take a math class, take a lot of math classes!
 
  #4


I wanted to reload the webpage to have the .swf reload from its initial state. Sort of like a hard reload for the .swf instead of going to frame 1 to reload the .swf.

If it's possible to reload the swf without reloading the webpage, then that would even be better. I wasn't sure it existed, but if it does, does anyone happen to know how to fully reload an swf without reloading the webpage?

 

 

 

=================================

=================================

=================================

 

 

 

출처: http://forums.adobe.com/thread/1178574

 

How to force refresh browser

Mar 27, 2013 4:44 AM

Tags: #as3 #javascript

Hello, how do I have a button to refresh the webpage that contains 1 whole swf website. The website is currently not hosted which can only be viewed locally though.

I want to refresh the whole swf to its initial state.

i tried using this function in AS3

btn.addEventListener(MouseEvent.CLICK, removeallFunction);

function removeallFunction (event:MouseEvent):void
{

   navigateToURL(new URLRequest ("javascript:refreshPage()"));

}

 

 
then in javascript

<script>

          function refreshPage(){

          window.location.reload(true);

          }

</script>

however, it does not reload the webpage...

Replies



  • ReportWas this helpful? Yes   No
  • Translate
  • Try using the ExternalInterface class to talk to the javascript in the html page.
  • Mar 27, 2013 4:47 AM   in reply to Newbielar
  • 1.Ned Murphy,


  • ReportWas this helpful? Yes   No
  • Translate
  • does this works even when the html is not hosted to a server?
  • Mar 27, 2013 5:19 AM   in reply to Ned Murphy
  • 2.Newbielar,


  • ReportWas this helpful? Yes   Noi tried changing my button function intoif(ExternalInterface.available) ExternalInterface.call("refreshPage","");However, it still does not refresh/reload the html file too...Was this helpful? Yes   NoMar 27, 2013 6:20 AM   in reply to NewbielarHave you tried just linking to the page using navigateToURL and  "_self" as the window parameter?TranslateReport
    btw, i have already add my swf and html as trusted in the flash global settings.
  • Was this helpful? Yes   No
  • the externalinterface does not work anymore in flash 10?
  • i tried it already, i mean it does go to that page if im just using the swf, instead of the html holding the swf. However, upon going to that local/offline html containing the swf, it does not reload the html page again, so it still does not work though 
  • Mar 27, 2013 6:35 AM   in reply to Ned Murphy
  • Was this helpful? Yes   No
  • Report
  • Translate
  • is there any effective way for me to click a button in the SWF to reload the browser html page?
  • the refreshPage is the JS function.
  • import flash.external.ExternalInterface;
  • Mar 27, 2013 5:41 AM   i
  • It should.  Try it and see.
  • Mar 27, 2013 5:35 AM   in reply to Newbielar
  • 3.Ned Murphy,

 

 

=================================

=================================

=================================

 

 

 

 

반응형


관련글 더보기

댓글 영역