Skip navigation
disclicious
Currently Being Moderated

Strange cursor behavior?

Dec 6, 2012 6:22 AM

Hi, I'm brand new to Flex, and while testing my first program I noticed that I couldn't grab the hslider because my cursor was changing to a text selection cursor. Even though there is no text in the upper left corner, and a panel with no text that contains the slider, when I hover over the top left corner of the application the cursor turns to a selection cursor.  I have no Idea why this is happening.  There are no hidden text boxes or anything like that.  Any help would be appreciated.  Here's the code.

 

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

<mx:Application

xmlns:mx="http://www.adobe.com/2006/mxml"

width="

400" height="280" backgroundColor="0xFFFFFF"

backgroundImage="

@Embed('../bg.png')" creationComplete="setup()" horizontalGap="10"

layout="

absolute" themeColor="0x8D8D8D" xmlns:components="com.adobe.sync.components.*">

 

 

 

 

<mx:Script>

<![CDATA[

 

import com.adobe.sync.events.SyncSwfEvent;

 

 

import flash.display.MovieClip;

 

import flash.events.*;

 

import flash.events.TimerEvent;

 

import flash.text.TextField;

 

import flash.utils.Timer;

 

 

import mx.core.*;

 

 

private var ui : UIComponent = new UIComponent();

 

private var tf:TextField;

 

private var time:Timer;

 

private var secondsLeft:Number = 300;

 

private var started:Boolean;

 

private var min:Number;

 

private var sec:Number;

 

private var timerStarted:Boolean = false;

 

 

public function setup() : void

{

tf =

new TextField();

timeLabel.text =

"";

ui.addChild(tf);

addChild(ui);

time =

new Timer(1000);

time.addEventListener(TimerEvent.TIMER, tick);

 

//ui.addEventListener('enterFrame', startTimer);

syncConnector.addEventListener(SyncSwfEvent.ROLE_CHANGED, roleChanged);

 

 

}

 

 

function roleChanged(event:SyncSwfEvent):void

{

 

if (syncConnector.role == "owner")

{

hostPanel.visible =

true;

showButton.visible =

false;

}

 

else

{

hostPanel.visible =

false;

showButton.visible =

false;

}

}

 

 

function tick(e:TimerEvent)

{

secondsLeft = secondsLeft - 1;

min = Math.floor(secondsLeft / 60);

sec = secondsLeft % 60;

 

trace(sec);

 

trace (sec % 10);

 

if (secondsLeft <= 0)

{

countDownText.visible =

false;

countDownFinishedText.visible =

true;

timeLabel.text =

"0:00";

}

 

else if (sec < 10)

{

timeLabel.text = String(min +

":0" + sec);

}

else {

timeLabel.text = String(min +

":" + sec);

}

 

}

 

 

 

function startTimer()

{

 

secondsLeft = timeSlider.value * 60;

time.start();

toggleControls();

countDownFinishedText.visible =

false;

syncConnector.dispatchSyncMessage(

"updateTime", secondsLeft, false);

}

 

 

function syncMessageReceived(event:SyncSwfEvent):void

{

 

switch (event.data.msgNm){

 

case "updateTime":

 

if (!timerStarted)

startTimer();

secondsLeft = event.data.msgVal;

 

break;

}

}

 

 

function toggleControls()

{

 

if (hostPanel.visible == true)

{

hostPanel.visible =

false;

showButton.visible =

true;

}

else if(showButton.visible == true)

{

showButton.visible =

false;

hostPanel.visible =

true;

}

}

 

]]>

 

</mx:Script>

 

 

<components:SyncConnector id="syncConnector" syncMessageReceived="syncMessageReceived(event)" />

 

<mx:Button id="showButton" right="20" bottom="20" label="Show Controls" click="toggleControls()"/>

 

<mx:VBox x="30" width="50%" textAlign="left" verticalCenter="10">

 

<mx:Text id="countDownText" x="28" width="168" fontSize="16"

text="

The meeting will resume in..." verticalCenter="-45"/>

 

<mx:Label id="timeLabel" x="28" y="127" width="152" height="74" fontSize="48"/>

 

<mx:Text id="countDownFinishedText" width="152" fontSize="16"

text="

The meeting will continue shortly" verticalCenter="58"/>

 

</mx:VBox>

 

<mx:Panel id="hostPanel" left="20" right="20" top="20" bottom="20" alpha="1.0" layout="absolute"

title="

Host Controls">

 

<mx:Button id="hideButton" right="10" bottom="10" label="Hide Controls"

click="toggleControls()"

/>

 

<mx:Button left="10" bottom="10" label="Start" click="startTimer()"/>

 

<mx:HSlider id="timeSlider" left="10" right="10" top="10" height="36"

labels="

[0,20,40,60,80,100,120]" liveDragging="true" maximum="120"

snapInterval="

5" tickInterval="10" value="10"/>

 

</mx:Panel>

 

 

 

</mx:Application>

 
Replies
  • Currently Being Moderated
    Dec 6, 2012 1:33 PM   in reply to disclicious

    You've got your countdown text in the upper left hand corner (X=28).  Change that to a label. 

     

    If I ever have a front end issue where nothing happens when I think it should it is more often than not due to a front end error being thrown.  However, you will only see this error if you are running the debugger version of Flash in your browser (remember it is browser specific - so one loaded on Chrome isn't the same as one loaded in Firefox, etc).  Google "flash debugger player" to find it. 

     

    I've noticed you've got an "mx" prefix on everything including your app.  MX was the precurser to the "S" (Spark) prefix.  There are a few remaining components that are still MX, but you should really be using Spark components for everything.  Faster, better, easier, etc. 

     

    Finally, you're really into absolule layouts, huh?  Some objects (like the panel) already have layouts assigned to make your life easier.  You'll want to get into building skins and components to build out the layouts like you prefer then you'll spend less time with all the x and y business.  Also try playing with the vert and horizontal layouts. 

     

    Good luck!

     
    |
    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