Skip navigation
Currently Being Moderated

Basic Question:  How to call a Class in mxml and Run it

Jul 26, 2013 8:13 AM

Tags: #flash_builder #4.0 #standard #away3d #3.6

Hi.  I'm doing my bit to try and learn Away3D.  I have successfully run the application from Flash Builder 4.0 standard as an ActionScript Project.  However now I want to run it as a Flex Project which gives me the ability to run it as a desktop application via AIR.

 

I have the following code:  (Why is my code not executing the SphereDemo.as Class which is supposed to be able to display a Poly Sphere on the viewport?)

 

 

<?xml version="1.0" encoding="utf-8"?>

<s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009"

                       xmlns:s="library://ns.adobe.com/flex/spark"

                       xmlns:mx="library://ns.adobe.com/flex/mx"

                       creationComplete="runMe();">

    <fx:Declarations>

        <!-- Place non-visual elements (e.g., services, value objects) here -->

    </fx:Declarations>

    <fx:Script>

        <![CDATA[

            public function runMe():void

            {

                var mySphere:SphereDemo = new SphereDemo();

                mySphere;

                //SphereDemo;

            }

           

        ]]>

    </fx:Script>

</s:WindowedApplication>

 
Replies
  • Currently Being Moderated
    Jul 26, 2013 12:19 PM   in reply to markerline

    It appears by the error 1009 that the mxml problem is with line 12 "public var mySphere:SphereDemo = new SphereDemo();"

     

    No,  the error is at C:\Users\root\Adobe Flash Builder 4.6\AwayMXML\src\AwayAS.as line 27.

     

    There is a problem in the AwayAS.as code.

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 26, 2013 12:46 PM   in reply to markerline

    It's surprising, but there can be any number of reasons.

     

    I was surprised that  you weren't able to interpret the stack trace to see where the error was.

     

    The debugger is your friend.

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 26, 2013 3:26 PM   in reply to markerline

    I think this is a bad way to try and understand how MXML works.

     

    Get used to working with MXML, then look at this project once you understand what is going on.

     

    Just getting it to compile is no guarantee of success - as you have found.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points