Skip to main content
Inspiring
June 26, 2013
Question

Image properties problem when view is not a firstView in Flex

  • June 26, 2013
  • 0 replies
  • 226 views

Hi “guys”, I have a problem in the creation complete handler.

I am using Flash Builder 4.7 (Flex SDK 4.9.1)

When I go to a view (meal3) when it is the “firstView” (ie firstView="views.meal3"), the image properties are correct (eg width=768).

However, if I go to another view as the firstView (eg firstView="views.allMeals") (which is what I want to do) and then click a button to go to the meal3 view, the image properties are null.

Anyone any ideas why this is and how I can correct the problem?

The meal3 code is as follows:

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

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

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

                    creationComplete="view1_creationCompleteHandler(event)">


  <fx:Script>

                    <![CDATA[

                              import mx.events.FlexEvent;

 

                              protected function view1_creationCompleteHandler(event:FlexEvent):void

                              {

        trace("Image Width = " + myImage1.bitmapData.width);

                              }

 

                    ]]>

  </fx:Script>

 

          <s:Image id="myImage1" source="images/image1.jpg" alpha="0" />

</s:View>

TIA,

Phil

This topic has been closed for replies.