Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6961339
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T15:31:04+00:00 2026-05-27T15:31:04+00:00

im a newbie in flex. Im have a question :) I have [Bindable] private

  • 0

im a newbie in flex. Im have a question 🙂

I have

[Bindable] 
          private var model:AlgorithmModel = new AlgorithmModel(); 
          private var serviceProxy:Algorithm = new Algorithm( model ); 

In MXML

                    private function Show():void
        {

            // now model.Solve_SendResult = null
            while(i<model.Solve_SendResult.length) //
            {
                Draw(); //draw cube
            }
        }
                    private function Solve_Click():void
        {
            //request is a array
            Request[0] = 2;
            Request[1] = 2;
            Request[2] = 3;
            serviceProxy.Solve_Send(request);

            Show();

        }
<s:Button x="386" y="477" label="Solve" click="Solve_Click();"/>

And when i call serviceProxy.Solve_Send(request); with request is array and i want use model.Solve_SendResult in my code flex to draw many cubes use papervison3d but in the first time i received model.Solve_SendResult = null . But when I click again then everything OK.

Anyone help me? Thanks?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T15:31:05+00:00Added an answer on May 27, 2026 at 3:31 pm

    The model.Solve_SendResult object contains a result of the executed serviceProxy.Solve_Send(request) method. The Solve_Send will be executed asynchronously and as a result, at the moment when you fire the show method the Solve_SendResult object may be still null.

    As a solution, you can use the following:

    1. Create a custom event

      package foo
      {
      import flash.events.Event;
      
      public class DrawEvent extends Event
      {
      public static const DATA_CHANGED:String = "dataChanged";
      
      public function DrawEvent(type:String, bubbles:Boolean=false, cancelable:Boolean=false)
      {
          super(type, bubbles, cancelable);
      }
      }
      }
      
    2. In your Algorithm class define the following:

      [Event(name=DrawEvent.DATA_CHANGED, type="foo.DrawEvent")] 
      public class Algorithm extends EventDispatcher{ 
      //your code
      
    3. In the Solve_SendHandler method of the Algorithm class add the following

      public virtual function Solve_SendHandler(event:ResultEvent):void
      {
      dispatchEvent(new DrawEvent(DrawEvent.DATA_CHANGED));
      //your code
      }
      
    4. In your MXML class create onLoad method and add an event listener to an instance of the Algorithm class as it shown below:

      <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" initialize="onLoad()">
      
      public function onLoad():void
      {
         serviceProxy.addEventListener(DrawEvent.DATA_CHANGED, onDataChanged);
      }
      
      private function onDataChanged(event:DrawEvent):void{
      while(i<model.Solve_SendResult.length) //
          {
              Draw(); //draw cube
          }
       }
      
    5. make the following changes in the Solve_Click() method:

      private function Solve_Click():void
      {
          //request is a array
          Request[0] = 2;
          Request[1] = 2;
          Request[2] = 3;
          serviceProxy.Solve_Send(request);
      }
      

    That is it! So, basically the code above do the following: you added a listener to your service (algorithm class), and the listener is listening for the DrawEvent.DATA_CHANGED event. The DrawEvent.DATA_CHANGED will be dispatched when your client receive a result of the Solve_Send invocation. Thus, the onDataChanged will draw your cube or do whatever you want 🙂

    The approach above is basic and you have to know how events work in flex and how you can deal with it. Additional information is available here:

    http://livedocs.adobe.com/flex/3/html/help.html?content=createevents_3.html
    http://livedocs.adobe.com/flex/3/html/help.html?content=events_07.html

    Regards,
    Cyril

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Flex newbie question: can MXML be generated on the fly, like HTML is generated
Newbie question i have following function: function isadult($description) { $bad=/*comma separated bad words*/; $bad=explode(,,$bad);
I'm still a newbie to Adobe Air/Flex, and still fairly new with SQL. I've
Newbie question. I have a NSMutableArray that holds multiple objects (objects that stores Bezier
Newbie question... The objective: I intend to have an HTML text input field as
I'm a newbie doing Objective-C, coming from Flex/Actionscript development. I have an iPhone app
Newbie question. I’m writing an ASP.Net MVC app in VB.Net and have been using
Newbie question URL: /categories/new?parent_id=6 Controller: def new @category = Category.new( :parent_id => params[ :parent_id
Newbie question... So I have two activities, Cherry and Apple, and each one has
I'm a newbie to Adobe Flex 3.0. I need to show data within the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.