Tracey Spratt very kindly posted a tutorial demonstrating passing
variables between the application and a popup window without events.
I've used this technique extensively in my own apps and am grateful to
Tracey for posting it.

However, I'm having trouble using this technique now for some reason.
Here's my code which isn't passing the data at all. Anyone spot my
bloopers please?

Popup titleWindow code:

<?xml version="1.0" encoding="utf-8"?>
<mx:TitleWindow xmlns:mx="http://www.adobe.com/2006/mxml";
layout="absolute" width="596" height="134" title="Attention:"
titleIcon="@Embed(source='/images/alarmicon.png')"
styleName="alertStyle" creationComplete="setTimer();">
        <mx:Style>
                
                .alertStyle {
                font-family: Verdana;
                flashType: true;
                font-weight: normal;
                color: #000000;
                font-size: 18pt;
                background-color: #FF9999;
                border-color: #FF9999;
                roundedBottomCorners: true;
                cornerRadius: 15;
                borderStyle: solid;
        }
                
        </mx:Style>
        <mx:Script>
                <![CDATA[
                        import ssp.debugging.TraceWindow;
                        import flash.utils.Timer;
                        import mx.managers.*;
                        public var timer:Timer;
                        
                        public var tw:TraceWindow = new TraceWindow("tw");
                        
                        [Bindable]
                public var messageString:String; 
                
                [Bindable]
                public var messageDuration:int;
        
                
                private function setTimer():void
                {
                        
                        tw.title = "String:";
                                tw.visible = true;
                                tw.trace(messageString);
                        // var stringArray:Array = messageString.split("|");
                        
                        alertMessage.text = messageString;
                        timer = new Timer((messageDuration * 1000), 1);
                        ;
                                timer.addEventListener(TimerEvent.TIMER, 
onTimer);
                                if (timer.running)
                                        {
                                                timer.stop();
                                        }
                                timer.start();
                }
                        
                        private function onTimer(event : TimerEvent):void
                        {
                                PopUpManager.removePopUp(this);
                        }
                        
                ]]>
        </mx:Script>
        <mx:Label x="10" y="30" textAlign="left" fontSize="18"
id="alertMessage" text=""/>

</mx:TitleWindow>

Main app MXML:

public function showMessage(messageItem:String, messageDuration:int): void
                {
                        
                        
                        var alertInstance:alertPopupDialog =
                alertPopupDialog(PopUpManager.createPopUp(this,
                alertPopupDialog,
                true));     //instantiate and show the title window
                        
                        PopUpManager.centerPopUp(alertInstance);
                        alertInstance.messageString = messageItem
                        alertInstance.messageDuration = messageDuration;
                        
                        
                }

no data makes it to the Popup Window.

Reply via email to