Greetings.
First of all, thanks for your time in advance if someone
could provide some help.
I am working on a new project, but I'm using the now (mostly considered
legacy from what I have seen) flex 1.5 framework.
I'm not really worried about learning the old flex framework, but I am
finding difficulties in using it's IDE, flexbuilder 1.5.
I am not certain if this is normal operation on the IDE, but when
debugging a program, is it normal for the debugger to only step through
those breakpoints defined only within the application's main .mxml file,
jumping past breakpoints defined in other classes? Let me get into some
detail...
Assume I have an application in Main.mxml, which makes a call to a
singleton ActionScript class such as this:
[[MySingleton.as]]
class MySingleton {
private static var myInstance : MySingleton;
private function MySingleton() {
//nothing relevant I believe...
}
public static function getInstance() {
if ( myInstance == undefined ) {
myInstance = new MySingleton();
}
return myInstance;
}
public function doSomething() {
// let's just trace a greeting
trace( "This is a greeting" );
}
}
[[end of MySingleton.as]]
If I call the instance in this way...
[[Main.mxml]]
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml"
xmlns:testApp="*" >
<mx:Script>
<![CDATA[
public function callSingleton() {
MySingleton.getInstance().doSomething();
}
]]>
</mx:Script>
<mx:VBox>
<mx:Button label="Call singleton" click="callSingleton();"/>
</mx:VBox>
</mx:Application>
[[end of MySingleton.as]]
Not surprisingly, any breakpoint I set within Main.mxml will stop the
execution of the program.
However, if I set a breakpoint on MySingleton::doSomething(), the
debugger will warn that there
are no breakpoints set, and it won't stop over the breakpoint set on
such function.
Is this normal behavior for the debbugging feature of flexbuilder 1.5?
Or is there sometsetting I'm missing? Or there might perhaps be another tool
for debugging flex programs?
If I may also use this opportunity (and as I'm fairly new to
ActionScript 2 from a Java background),
what's the purpose of declaring a function attribute inside a class like
this?
class Test {
public var anAttribute : Function;
}
and if I declare an instance of this class...
var myTest : Test = new Test();
and I say...
myTest.anAttribute();
what happens then?? :S
With this I mean, that I know there is something useful or it is some
important design
principle on which ActionScript relies on. But the last time I remember
seeing something
similar was with function pointers in C.
Could someone develop on this concept, or refer me to some document
explaining what
are the implications and uses for function attributes?
Again, thanks for your time and help.