Adobe Dreamweaver Forums



Last 10 THreads :         Not Recognizing XML File (Last Post : andrewmcgibbon - Replies : 1 - Views : 2 )           »          CLOB datatype in flex (Last Post : run,ryan! - Replies : 4 - Views : 5 )           »          Problem initialising quicktime (Last Post : Sean Wilson - Replies : 1 - Views : 2 )           »          Library documents do not accept SWF objects (Last Post : micdim1 - Replies : 1 - Views : 2 )           »          image looks different in different browsers? (Last Post : patrickpmm - Replies : 4 - Views : 5 )           »          Can't get drop down menu to drop down (Last Post : danoj22 - Replies : 5 - Views : 6 )           »          Need advice on flash efects (Last Post : Sibee_007 - Replies : 0 - Views : 1 )           »          Table cell - text formatting question (Last Post : JRStaf4ord - Replies : 6 - Views : 7 )           »          Adobe Flash 10 kills Wimpy (Last Post : midiwriter - Replies : 106 - Views : 107 )           »          Em Dash (Last Post : David Stiller - Replies : 1 - Views : 2 )           »         

test


Color & Font Picker
CSS Validator
CSS Generator
CSS Generator (Advanced)
Drop Down Menu Maker
HTML Validator
Keyword Density Analyzer
Popup Maker
Mouseover Maker
Link Checker
Link Popularity
Meta Tag Creator
Meta Tag Viewer
Table Maker
Table Maker (Advanced)
Link Extractor
HTTP Headers
HTML Optimizer
HTML Encrypter
htaccess URL Rewrite
Spider View
Webpage Analyzer
C Class Checker
Crontab Entry Generator
Domain Name Checker
Dreamweaver Code Cleaner
Frontpage Code Cleaner
Determine Country From IP
Spam List Check
Websafe Color Tool
Whois Lookup
Alexa Rank Comparison
Code To Text Ratio
Advertising ROI Calculator
Email Encrypter
Google Dance Tool
Gradient Image Maker
.htaccess Ban Generator
.htaccess Password Generator
Screen Resolution Tool
Text Diff Tool
Advanced Text Diff Tool
Google banned
Google datacenter search
Index checker
Keyword Suggestion Tool
Link popularity
Ranking tool
Search engine position
Url redirect checker
Visual pagerank
Browser details
Alexa Traffic Rank
Broken link checker
Domain lookup
IP Location
Reverse IP/Look-up
Server status
Website speed test
Link Extractor
Competition Research Tool
Advanced Meta Tag Generator
Robots.txt Syntax Checker
Robots.txt Generator
Broken Link Checker
Color Converter
HTML Converter
Page Rank Predictor
Image Optimizer
Favicon Generator

User Info Statistics
Go Back   Adobe Dreamweaver Forums > Macromedia Software > Flex
 
Tags:



Reply
  #1 (permalink)  
Old 11-04-2008, 09:02 AM
alice_data
 
Posts: n/a
Diggs:
Default Post Variables Using Actionscript

Hi,

I have seen on the docs that we could write HTTPService in Actionscript
method. I have completed the entire section based on the description of the
method defined on the doc, but I am having some issues defining the variables
to pass to the actual service (mx:request as in MXML).

I need to know the actual variable that gets passed to the service, because
I would like to reuse the information returned from the service for further
edits. Since this information is not stored in the XML, I wonder if anyone can
tell me what is wrong with the syntax below? Currently, all I get is this
error:

TypeError: Error #1009: Cannot access a property or method of a null object
reference.

Anything is appreciated.

private var request:HTTPService;

public function useHttpService(parameters:Object):void {
var request:URLRequest = new
URLRequest("http://192.168.10.62/simulation.php");
request.method = URLRequestMethod.POST;
request.data.population = "population";
request.data.market_capture = "market_capture";
request.data.simulation_length= "simulation_length";
var loader:URLLoader = new URLLoader();
loader.addEventListener(Event.COMPLETE, function(event:Event):void {
trace("finished sending and loading: "+ loader.data);
});
loader.load(request);
}



Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 11-04-2008, 09:02 AM
Amy Blankenship
 
Posts: n/a
Diggs:
Default Re: Post Variables Using Actionscript


"alice_data" <webforumsuser@macromedia.com> wrote in message
news:ge7smi$cea$1@forums.macromedia.com...
> Hi,
>
> I have seen on the docs that we could write HTTPService in Actionscript
> method. I have completed the entire section based on the description of
> the
> method defined on the doc, but I am having some issues defining the
> variables
> to pass to the actual service (mx:request as in MXML).
>
> I need to know the actual variable that gets passed to the service,
> because
> I would like to reuse the information returned from the service for
> further
> edits. Since this information is not stored in the XML, I wonder if anyone
> can
> tell me what is wrong with the syntax below? Currently, all I get is this
> error:
>
> TypeError: Error #1009: Cannot access a property or method of a null
> object
> reference.


at which line?


Reply With Quote
  #3 (permalink)  
Old 11-04-2008, 09:02 AM
alice_data
 
Posts: n/a
Diggs:
Default Re: Post Variables Using Actionscript

Hi, Amy:

Looks like that the output does not like my calling variables like
request.data.population = "population"; , even though all I am doing here is
similar to the function in mx:request by defining the variables.

Since the root node of the XML output is year, I tried doing
request.year.population="population", and it still gave me the same error. Does
this provide you enough information about my errors?

Thanks in advance.

Alice


Reply With Quote


  #4 (permalink)  
Old 11-04-2008, 09:02 AM
Amy Blankenship
 
Posts: n/a
Diggs:
Default Re: Post Variables Using Actionscript


"alice_data" <webforumsuser@macromedia.com> wrote in message
news:ge8gan$83p$1@forums.macromedia.com...
> Hi, Amy:
>
> Looks like that the output does not like my calling variables like
> request.data.population = "population"; , even though all I am doing here
> is
> similar to the function in mx:request by defining the variables.
>
> Since the root node of the XML output is year, I tried doing
> request.year.population="population", and it still gave me the same error.
> Does
> this provide you enough information about my errors?


I think the problem is that you typed your variable as an HTTPService, but
then you try to fill it with a URLLoader. I'm amazed you didn't get a
compile time warning of an implicit coercion of type URLLoader to unrelated
type HTTPService.

You can't add extra properties to the built in objects (except Object of
course), so there is no way that you could attach a year property to either
a HTTPService or a URLRequest. That means that the above would never work,
and, again, I'm amazed you didn't get a compile-time error about an attempt
to access possibly undefined property year.

I'm thinking you _are_ getting compile-time errors, but you're ignoring them
and running the file anyway. The best advice I can give you is to pay
attention to warnings and errors, and don't try to go ahead when you're
getting them.

HTH;

Amy


Reply With Quote
  #5 (permalink)  
Old 11-04-2008, 09:02 AM
alice_data
 
Posts: n/a
Diggs:
Default Re: Post Variables Using Actionscript

Hi, Amy:

Sorry, but I think I am getting a little confused at this point. I have
removed
var loader:URLLoader = new URLLoader();
loader.addEventListener(Event.COMPLETE, function(event:Event):void {
trace("finished sending and loading: "+ loader.data);
});
loader.load(request);
and ran the code again and received the same error as before.

Part of the problems with the error I have been getting is that I have not
defined my parameters correctly, but again I tried to take the parameter
definition from the following line, it tells me I need one argument: <mx:Button
label="Submit" id="mySubmitButton" click="useHttpService()"/>. What should I
put in the parenthesis?

The doc I referred to is at
http://livedocs.adobe.com/flex/201/h.../wwhelp.htm?co
ntext=LiveDocs_Book_Parts&file=dataservices_099_15 .html, but I think my main
problem here is that I am not sure how to define the variables and pass it to
the actual service and have the variables be handled internally through
Actionscript. Or, is what I trying to accomplish here not possible at all?

Thanks for your help.

Alice

Reply With Quote
  #6 (permalink)  
Old 11-04-2008, 09:02 AM
Amy Blankenship
 
Posts: n/a
Diggs:
Default Re: Post Variables Using Actionscript


"alice_data" <webforumsuser@macromedia.com> wrote in message
news:ge9nf1$1ai$1@forums.macromedia.com...
> Hi, Amy:
>
> Sorry, but I think I am getting a little confused at this point. I have
> removed
> var loader:URLLoader = new URLLoader();
> loader.addEventListener(Event.COMPLETE, function(event:Event):void {
> trace("finished sending and loading: "+ loader.data);
> });
> loader.load(request);
> and ran the code again and received the same error as before.
>
> Part of the problems with the error I have been getting is that I have
> not
> defined my parameters correctly, but again I tried to take the parameter
> definition from the following line, it tells me I need one argument:
> <mx:Button
> label="Submit" id="mySubmitButton" click="useHttpService()"/>. What should
> I
> put in the parenthesis?
>
> The doc I referred to is at
> http://livedocs.adobe.com/flex/201/h.../wwhelp.htm?co
> ntext=LiveDocs_Book_Parts&file=dataservices_099_15 .html, but I think my
> main
> problem here is that I am not sure how to define the variables and pass it
> to
> the actual service and have the variables be handled internally through
> Actionscript. Or, is what I trying to accomplish here not possible at all?


Try changing this:
private var request:HTTPService;
to
private var request: URLRequest;

I still think you're getting a lot of warnings you're ignoring (check the
problems tab). You should have gotten a duplicate variable definition for
what you had.

What you're trying to accomplish is possible, but you DO need to pay
attention to the warnings and errors Flex is trying to tell you about. They
are your friend.


Reply With Quote


  #7 (permalink)  
Old 11-04-2008, 09:02 AM
alice_data
 
Posts: n/a
Diggs:
Default Re: Post Variables Using Actionscript

Hi, Amy:

Thanks for the tip. After a few more fixings, I could see the results now by
using a navigate(url) function and see the output, as in the code below shows.

However, when I execute the Flex application, I get no updated result
display on the application itself according to the input. I get no errors
either. Does this mean that I have errors in my EventListeners lines? And, are
there specific functions I should look into to get this to work?

Thanks again for your help.

private var request: URLRequest;
private var urlLoader:URLLoader;

public function runService(parameters:Object):void {
var url:String = "http://localhost/simulator.php";
var request:URLRequest = new URLRequest(url);
var variables:URLVariables = new URLVariables();
variables.population=population.text;
request.data = variables;
request.method = URLRequestMethod.POST;
urlLoader = new URLLoader();
urlLoader.addEventListener("result", httpResult);
urlLoader.addEventListener("fault", httpFault);
urlLoader.load(request);
currentState="Result";
}

private function httpResult(e:ResultEvent):void {

//some processing
}

private function httpFault(e:FaultEvent):void {
Alert.show(e.message.toString(),"Error Occurred!");
}

Reply With Quote
  #8 (permalink)  
Old 11-04-2008, 09:02 AM
Amy Blankenship
 
Posts: n/a
Diggs:
Default Re: Post Variables Using Actionscript


"alice_data" <webforumsuser@macromedia.com> wrote in message
news:ge9tcl$9g7$1@forums.macromedia.com...
> Hi, Amy:
>
> Thanks for the tip. After a few more fixings, I could see the results
> now by
> using a navigate(url) function and see the output, as in the code below
> shows.
>
> However, when I execute the Flex application, I get no updated result
> display on the application itself according to the input. I get no errors
> either. Does this mean that I have errors in my EventListeners lines? And,
> are
> there specific functions I should look into to get this to work?


is the actual content of your httpResult
//some processing
or do you actually do some processing there?

If you don't take the result and do anything with it, then you might as well
not have made the call.


Reply With Quote
  #9 (permalink)  
Old 11-04-2008, 09:02 AM
alice_data
 
Posts: n/a
Diggs:
Default Re: Post Variables Using Actionscript

Hi, Amy:

Yes, I did mean to do something with the code, but since that snippet was
working in the first place, that is why I did not put it here.

My revised version is in the edited version above. It looks like everything
is finally working.

Thanks a lot.

Alice

Reply With Quote


  #10 (permalink)  
Old 11-04-2008, 09:02 AM
Amy Blankenship
 
Posts: n/a
Diggs:
Default Re: Post Variables Using Actionscript


"alice_data" <webforumsuser@macromedia.com> wrote in message
news:gea5h9$kri$1@forums.macromedia.com...
> Hi, Amy:
>
> Yes, I did mean to do something with the code, but since that snippet
> was
> working in the first place, that is why I did not put it here.
>
> My revised version is in the edited version above. It looks like
> everything
> is finally working.
>
> Thanks a lot.


You're welcome :-)


Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



© Camley Interactive (camley.info) 2008 - all logos and images are copywrite their respective owners.
Proud member of the Camley Interactive Network
All times are GMT. The time now is 10:13 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0 ©2007, Crawlability, Inc.
Cheap Car Insurance - Compare Motor Insurance
Endsleigh Car Insurance Natwest Car Insurance
More Than Car Insurance Norwich Union Car Insurance
Prudential Car Insurance Zurich Car Insurance
Inactive Reminders By Mished.co.uk