views:

261

answers:

2

I would like to have a FLEX SWF Menu in .NET that is animated, and use button clicks to update an iFrame in an .NET 2.0 Ajax enabled application without a page update or refresh. If I use URLVaribles in Flex, The only way I've gotten to them to ASP.NET is via URL Page Navigation which always refreshes the screen. There is a LOADVARS function but I have not gotten it to work. Is there any suggestion on how one would do this??

Do I need to look into using JSON for Flex??? Or WebOrb???

This works fine... but with a page refresh (which is not cool)...

  navigateToURL( new URLRequest( "http://localhost:50294/WEBAPP/Default.aspx?P=2&H=500" ), "_self" );

This does NOT work fine... (in fact it just loads the whole page .NET page in FLEX, not what I am looking for)

var variables:URLVariables = new URLVariables();
variables.P="1";
variables.H="400";
var request:URLRequest = new URLRequest();
request.url = "http://localhost:50294/Timber2/Default.aspx?";
request.method = URLRequestMethod.POST;
request.data = variables;
var loader:URLLoader = new URLLoader();
loader.dataFormat = URLLoaderDataFormat.TEXT;
loader.addEventListener(Event.COMPLETE, uploadComplete);
try
{
    loader.load(request);
}
catch (error:Error)
{
    trace("Unable to load URL");
}
A: 

What you are really trying to do is interface with JavaScript and not .NET. This is accomplished via the ExternalInterface:

http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/external/ExternalInterface.html

ExternalInterface provides a first class connection to JS via Actionscript 3 and should be able to accomplish what you are asking.

Joel Hooks
hi Joe, let me give this a whack.. thanks for the comments, I will mark as answer soon but the only problem is I don't know nuttin' about javascript guess I can figure it out though, it ain't much diff'rnt then C# or actionscript I figure...
CraigJSte
A: 

You can use navigateToURL; you just need specify the name of the iframe in the code. For example, if it's called "myFrame":

navigateToURL(
    new URLRequest("http://localhost:50294/WEBAPP/Default.aspx?P=2&H=500"), 
    "myFrame");

Better yet, use relative links so that your code will work in a production environment (this is assuming the menu and the iframe are on the same web server):

navigateToURL(new URLRequest("/WEBAPP/Default.aspx?P=2&H=500"), "myFrame");
Jacob
Jacob.... I tried, no work-ie... It opened a new window with the iframe loaded.. see the url variables are telling it what aspx page to load in the iframe tag... there's probably a better way to do this... Anyway, it's not workin...
CraigJSte