Skip to main content
Inspiring
September 25, 2013
Answered

jQuery call within WebStageView

  • September 25, 2013
  • 1 reply
  • 750 views

Hello,

I have seen a few posts SIMILAR to this on this forum, but would like to see if anyone can help with my specific issue.

I am making an Iphone/Pad app, and have a Flash file that solely constst of a WebStageView script listed below. Also packaged within the app is a htm site directory called /HYIM/ with subfolders of HYIM/dinner/afternoon/a .

import flash.geom.Rectangle;

import flash.media.StageWebView;

import flash.filesystem.File;

import flash.utils.Timer;

import flash.events.TimerEvent;

stop();

var webView:StageWebView = new StageWebView();

webView.stage = this.stage;

webView.viewPort = new Rectangle(0,0,stage.stageWidth,stage.stageHeight);

var fPath:String = new File(new File("app:/HYIM/index.htm").nativePath).url;

webView.loadURL( fPath );

This loads fine within the app, and /HYIM/ is easily navigated, but within one of the pages there is a jQuery AJAX call that is not resolving. Below is an example of the code within this htm file. The page loads, but this particular code which is loading an external text file is not working. I suspect it is due to the relative URL, but cannot figure out how to properly point it within the app.

// set dinner text using jQuery AJAX call

          var url = "dinner//afternoon//a" + day + ".txt";

          $("#dinner").load(url);

I have tried 'app:/' and 'file:///' and could not get it to load.

Any help would be greatly appreciated!!!

Thank you.

This topic has been closed for replies.
Correct answer Freelance77

Thanks everyone. I found out the stupid thing I was overlooking.

Within the <head>, the jQuery script was being called remotely.

I had to change the URL to a local copy, and then it worked fine.

uggh

1 reply

Inspiring
September 26, 2013

If you are using jQuery to make an AJAX call why dont you host your index.html on a server rather than bundled in the app ?

Also...  I suggest using the DarkRedz UIWebView ANE.  I had so many problems with stageWebView.  The DarkRedz ANE allows you to use a true iOS safari browser and allows you to communicate back and forth from your HTML / JAVASCRIPT to ACTIONSCRIPT both ways.

Inspiring
September 26, 2013

Thank you for your reply. We are wanting the app to be self contained, and not have to be connected to the internet.

I haven't had any problems with the StageWebView; it seems to load fine, I just have a problem with that one specific call. I will look into the other option though.

Any other ideas as to how to get the url to resolve?

Freelance77AuthorCorrect answer
Inspiring
September 27, 2013

Thanks everyone. I found out the stupid thing I was overlooking.

Within the <head>, the jQuery script was being called remotely.

I had to change the URL to a local copy, and then it worked fine.

uggh