dacat / sfapi

Automatically exported from code.google.com/p/sfapi
0 stars 0 forks source link

Adding a componet of mx:Image with an Embed source creates a problem assigning ids #28

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.
Add this component to MXML file

    <mx:Image id="shippingIconProcessing"
source="@Embed(source='/images/icons.swf',symbol='myIcon1')"
              x="{(this.width/2)-20}"
              y="{(this.height/2)-20}"
              />

2. Add library to project

3. Start swf in browser

What is the expected output? What do you see instead?

The displaying of the swf is corupted and the following stack trace is shown

TypeError: Error #1009: Cannot access a property or method of a null object
reference.
    at sfapi.core::AppTreeParser/assignID()
    at sfapi.core::AppTreeParser/setTooltipsToID()
    at SeleniumFlexAPI/applicationCompleteHandler()
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at mx.managers::SystemManager/preloader_preloaderDoneHandler()
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at mx.preloaders::Preloader/displayClassCompleteHandler()
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at
com.overstock.webdev.checkout.view.preloader::PreloaderDisplayBase/timerHandler(
)
    at flash.utils::Timer/_timerDispatch()
    at flash.utils::Timer/tick()

What version of the product are you using? On what operating system?

          <groupId>com.thoughtworks.selenium</groupId>
          <artifactId>sfapi</artifactId>
          <version>0.2.6</version>
          <type>swc</type>
          <scope>internal</scope>

Using MAC OS X 10.6.3 but it seems to happen on any

Please provide any additional information below.

Original issue reported on code.google.com by anderson...@gmail.com on 3 May 2010 at 2:21

GoogleCodeExporter commented 9 years ago
This seems to fix this issue for me. Do you have a code review process? If so I 
can
fix it up and add unit tests

Index: trunk/sfapi/src/main/flex/sfapi/core/AppTreeParser.as
===================================================================
diff -u -N -r5064 -r5481
--- trunk/sfapi/src/main/flex/sfapi/core/AppTreeParser.as   (.../AppTreeParser.as)
(revision 5064)
+++ trunk/sfapi/src/main/flex/sfapi/core/AppTreeParser.as   (.../AppTreeParser.as)
(revision 5481)
@@ -190,6 +190,10 @@
      */
     private function hasFirstChild(node:AppTreeNode):Boolean
     {
+      if (node == null || node.child == null){
+        return false;
+      }
+
       if(node.child.hasOwnProperty("numChildren") && node.child.numChildren > 0)
       {
         firstNode = new AppTreeNode(node.child.getChildAt(0), 0, false);
@@ -331,7 +335,7 @@
      */
     private function assignID(node:Object):void
     {
-      if(node.hasOwnProperty("id") && node.hasOwnProperty("toolTip"))
+      if(node != null && node.hasOwnProperty("id") && 
node.hasOwnProperty("toolTip"))
       {
         if(node.id == null)
         {

Original comment by anderson...@gmail.com on 3 May 2010 at 9:17