function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
maceWindumaceWindu 

USING FLEX and ITS NOT WORKING AND I HAVE NO IDEA WHY!

Can someone please help me?? I'm trying to run the supposedly simple application in one of the flex tutorials only it DOES NOT WORK!!!!!! I TRIED EVERYTHING AND THE SALESFORCE DOCMENTATION IS 2247 PAGES LONG!!! HOW DO I GET STARTED WITH FLEX??? WHO DO I HAVE TO TALK TO???????? DOES ANYONE KNOW???

HERE IS THE CODE I'M TRYING TO RUN. I copied the toolkit SWC's  into my lib folder in the project in FLEX and this is the exact code that is in the tutorial that is floating around YOUTUBE??? SO WHY IN THE HELL DOES IT NOT WORK WHAT AM I MISSING????? 

 

 

 

 <?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" xmlns:salesforce="http://www.salesforce.com/"
    applicationComplete="doLogin()">

    <mx:Script>
        <![CDATA[
            import com.salesforce.results.LoginResult;
            import com.salesforce.results.QueryResult;
            import com.salesforce.AsyncResponder;
            import com.salesforce.objects.LoginRequest;
            
            private function doLogin():void
            {
                var lr:LoginRequest = new LoginRequest();
                lr.username = "MY FREAKING USERNAME";
                lr.password = "MY FREAKING PASSWORD";
                lr.callback = new AsyncResponder(loginSuccess);
                force.login(lr);
            }    
            
            private function loginSuccess(result:LoginResult):void
            {
                force.query("SELECT Id, LastName FROM Contact", new AsyncResponder(querySuccess));
            }
            
            private function querySuccess(result:QueryResult):void
            {
                grid.dataProvider = result.records;
            }
        ]]>
    </mx:Script>
    
    <salesforce:Connection id="force"/>
    
    <mx:DataGrid id="grid" width="400" height="300"/>
    
</mx:Application>

Best Answer chosen by Admin (Salesforce Developers) 
DevAngelDevAngel

First of all, lighten up on the CAPS LOCK KEY!  Virtual yelling and flailing of arms and gnashing of teeth is not conducive to community participation.

 

Now, take a deep breath.  There, that's better.  Seems that you have been focusing on the toolkit and not the Flash platform.  If you are trying to run your code from the local file system, you will need to modify the securty settings of your flash player.  Flash has increased security controls over the last couple of years and one modification is to not implicitly allow flash movies served from local file system to execute the cross domain calls required for the toolkit to function properly.

 

Run your code again and when the blank screen appears, right-click the player and select "Settings". This will bring up a small dialog box with various setting choices.  Click the big "Advanced" button to access the flash player settings web page.

 

 

Under the left hand navigation of that page, click "Global Security Settins Panel" to access the Global Security Settings Manager.  You will see a widget like the one shown below.  All you need to do is click "Edit Locations" and then "Add Location".  Click the "Browse for folder..." button and find you way through the file system to your flex workspace folder.  Once you have that path in the "Trust this location:" text box, click the "Confirm" button.

 

 

Go back to your project and re-launch your Flex app.

 

There are two very sophisticated platforms on either side of a Flex/Force.com implementation.  Please familiarize yourself with both.  Adobe has an excellent site for deveopers here Adob Flex Devnet.

 

You may now put your hair back in.  :smileywink:

Message Edited by DevAngel on 09-22-2009 09:31 AM

All Answers

SuperfellSuperfell
What's not working?
maceWindumaceWindu
when I try to run the code with my password i JUST GET A BLANK DATA GRID and nothing else ..that's what is not working. But I don't know why and I don't know where to look
maceWindumaceWindu
I'm not getting any error messages anywhere I looked. I created a couple of contacts to see if it would work and still nothing. The toolkit does work right?? My username and password are supposed to be the same as it is when I login to salesforce right? Do I have to pay some money or something to get this working? I only signed up for the free Developer EDITON thing. I copied the code exactly followed the YOU TUBE video exactly except for my user name and password ofcourse and still ...NOTHING! NOTHING! NOTHING! WHY? WHAT AM I NOT GETTING HERE?
Message Edited by maceWindu on 09-21-2009 02:28 PM
SuperfellSuperfell
nothing jumps out, can you add some debugging statements to see which flex functions are getting executed. (and please don't cross post your question into the other boards)
maceWindumaceWindu

usingSalesForce [Flex Application]   
    file:/C:/Users/MaceWindu/Documents/Flex%20Builder%203/usingSalesForce/bin-debug/usingSalesForce.html   
        Main Thread (Suspended)   
            usingSalesForce/doLogin   
            usingSalesForce/___usingSalesForce_Application1_applicationComplete   
            flash.events::EventDispatcher/dispatchEventFunction [no source]   
            flash.events::EventDispatcher/dispatchEvent [no source]   
            mx.core::UIComponent/dispatchEvent   
            mx.managers::SystemManager/preloader_preloaderDoneHandler   
            flash.events::EventDispatcher/dispatchEventFunction [no source]   
            flash.events::EventDispatcher/dispatchEvent [no source]   
            mx.preloaders::Preloader/displayClassCompleteHandler   
            flash.events::EventDispatcher/dispatchEventFunction [no source]   
            flash.events::EventDispatcher/dispatchEvent [no source]   
            mx.preloaders::DownloadProgressBar/timerHandler   
            mx.preloaders::DownloadProgressBar/initCompleteHandler   
            flash.events::EventDispatcher/dispatchEventFunction [no source]   
            flash.events::EventDispatcher/dispatchEvent [no source]   
            mx.preloaders::Preloader/dispatchAppEndEvent   
            mx.preloaders::Preloader/appCreationCompleteHandler   
            flash.events::EventDispatcher/dispatchEventFunction [no source]   
            flash.events::EventDispatcher/dispatchEvent [no source]   
            mx.core::UIComponent/dispatchEvent   
            mx.core::UIComponent/set initialized   
            mx.managers::LayoutManager/doPhasedInstantiation   
            Function/http://adobe.com/AS3/2006/builtin::apply [no source]   
            mx.core::UIComponent/callLaterDispatcher2   
            mx.core::UIComponent/callLaterDispatcher   
    file:/C:/Users/MaceWindu/Documents/Flex%20Builder%203/usingSalesForce/bin-debug/usingSalesForce.html   

 

 

As far as cross posting I'm just trying get the answer to my question. For some reason its not connecting I think.  

maceWindumaceWindu

 lr = (com.salesforce.objects.LoginRequest) com.salesforce.objects.LoginRequest (@5154b21)    
force = (com.salesforce.Connection) com.salesforce.Connection (@4e81eb1)    
    applicationDomain = null    
    _applicationDomain = null    
    applicationServerName = null    
    _applicationServerName = null    
    applicationUrl = null    
    _applicationUrl = null    
    batchSize = <setter>    
    client = <setter>    
    _defaultServerUrl = "https://www.salesforce.com/services/Soap/u/15.0" : String    
    _internalServerUrl = null    
    IsLoggedIn = false : Boolean    
    isLoggedIn = false : Boolean    
    isLoggingIn = false : Boolean    
    _loginCallback = null    
    loginResult = null    
    _loginResult = null    
    organizationId = null    
    portalId = null    
    protocol = "https" : String    
    _protocol = "https" : String    
    serverUrl = null    
    sessionId = null    

result = <errors during evaluation>    
    
doLogin = <errors during evaluation>    
    
lr.callback = (com.salesforce.AsyncResponder) com.salesforce.AsyncResponder (@501c589)    
    context = null    
    faultHandler = <getter>    
    resultHandler = <getter>    
force.query = <errors during evaluation>    
    

maceWindumaceWindu

Its a login error I think. This is the error I get.Anyone got thi error and knows how to fix it

 

 [FaultEvent fault=[RPC Fault faultString="HTTP request error" faultCode="Server.Error.Request" faultDetail="Error: [IOErrorEvent type="ioError" bubbles=false cancelable=false eventPhase=2 text="Error #2032: Stream Error. URL: http://www.salesforce.com/Soap/u/15.0?1000.1135473255999"]. URL: http://www.salesforce.com/Soap/u/15.0?1000.1135473255999"] messageId="2BDC7291-DEFF-39C9-4058-E1114C20C811" type="fault" bubbles=false cancelable=true eventPhase=2]

XactiumBenXactiumBen
Have you appended the security token on the end of your password?  If not go to Setup, My Personal Information then Reset My Security Token.  You should get an email with your security token in.
maceWindumaceWindu
I did that and appended the security token at the end of my password  and.....NOPE it didn't work.
maceWindumaceWindu
NOT ONLY DO I GET THE SAME BLANK DATA GRID BUT THE ERROR MESSAGE DOESN'T COME UP AT ALL
maceWindumaceWindu
Does anyone else have any neat Ideas?? I noticed that this has been a ongoing problem and no one had an answer then either. Is there someone else with suggestions please.
DevAngelDevAngel

First of all, lighten up on the CAPS LOCK KEY!  Virtual yelling and flailing of arms and gnashing of teeth is not conducive to community participation.

 

Now, take a deep breath.  There, that's better.  Seems that you have been focusing on the toolkit and not the Flash platform.  If you are trying to run your code from the local file system, you will need to modify the securty settings of your flash player.  Flash has increased security controls over the last couple of years and one modification is to not implicitly allow flash movies served from local file system to execute the cross domain calls required for the toolkit to function properly.

 

Run your code again and when the blank screen appears, right-click the player and select "Settings". This will bring up a small dialog box with various setting choices.  Click the big "Advanced" button to access the flash player settings web page.

 

 

Under the left hand navigation of that page, click "Global Security Settins Panel" to access the Global Security Settings Manager.  You will see a widget like the one shown below.  All you need to do is click "Edit Locations" and then "Add Location".  Click the "Browse for folder..." button and find you way through the file system to your flex workspace folder.  Once you have that path in the "Trust this location:" text box, click the "Confirm" button.

 

 

Go back to your project and re-launch your Flex app.

 

There are two very sophisticated platforms on either side of a Flex/Force.com implementation.  Please familiarize yourself with both.  Adobe has an excellent site for deveopers here Adob Flex Devnet.

 

You may now put your hair back in.  :smileywink:

Message Edited by DevAngel on 09-22-2009 09:31 AM
This was selected as the best answer
maceWindumaceWindu
Thank you DevAngel! Your suggestion worked for me.
crm123crm123

I found that when on my home network, I can login and see the data in the grid.When on the office network, I could not even login. I suspect this is because our office network has a proxy. How can I change this?

 

Thanks.

 

 

DevAngelDevAngel

Hi crm123,

 

Seems odd that it should not work with the proxy. 

 

Here is a good article with a link to all the info you ever wanted about Flash security.

 

http://viconflex.blogspot.com/2008/08/why-no-sandbox-violation-running-from.html

 

Also, make sure you can login to your developer edition from the office network.  Try opening a Force.com project against your developer edition using the Force.com IDE.  If you can do that, then I would definitely look around google to find out what needs to be done to the Flex project to compensate.

 

 

Cheers,

 

 

crm123crm123

Thank you for responding. I walked through the code and realized its not the proxy settings, but the fact that the sandbox instance I am working against is on a different set of servers.

 

 

var lr:LoginRequest = new LoginRequest(); sandbox.serverurl = "https://test.salesforce.com/services/Soap/u/16.0"; lr.username = "flextest@sandbox.com"; lr.password = "flextest123"; lr.callback = new AsyncResponder(loadGrid); sandbox.login(lr);

 

I can see my data now.