Flex Focus out handler runtime error 1009 , How to fix? - apache-flex

I am getting these weird runtime errors. I am using Flex 3.5 SDK with flash player set to 10.0.00.
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at mx.flash::UIMovieClip/removeFocusEventListeners()[E:\dev\flex\sdk\frameworks\projects\flash-integration\src\mx\flash\UIMovieClip.as:2368]
at mx.flash::UIMovieClip/focusOutHandler()[E:\dev\flex\sdk\frameworks\projects\flash-integration\src\mx\flash\UIMovieClip.as:2411]
I get this errors when I click on any other control in a popup. I am using buttons, textarea,textinput,and a list. I dont know how to fix this ... It would be great if someone pull me out this problem?

Without the code it's gonna be hard to pinpoint. This error could occur if you are trying to 1) access the property of an object that hasn't been created by the time the focus out handler is called, or 2) access the property of an object that ins't referenced in the focus out handler.
Make sure any non-local variables in the focus out handler reference an object that has been created somewhere in your application before the call to the focus out handler. Also, make sure a reference to each object gets passed into the focus out handler by declaring those variables globally, or passing the object to the function as a parameter.
Post the code if you can.

Seems you have to remove focus from your UIMovieClips before removing them from the stage:
http://forums.adobe.com/thread/658335?tstart=-1
Or just target flash player 10 where this bug is fixed.
Add this code to the top of any function that may remove a UImovieClip from the display list:
if (stage)
{
stage.focus = null;
}

Related

how to implement source filter property page?

I have followed the instructions at http://msdn.microsoft.com/en-us/library/windows/desktop/dd375010%28v=vs.85%29.aspx to create a property page for my CSourceStream based stream.
When testing with amcap I can see that amcap now shows the menu item to show the capture pin properties (ISpecifyPropertyPages::GetPages is queried). The problem is that when amcap calls OleCreatePropertyFrame it returns with E_FAIL and I am not sure why, it does not seem to even get to the stage of quering my dll for the factory method to instantiate the CBasePropertyPage based property class.
The problem was my DllRegisterServer only registered my filter.
I can use AMovieDllRegisterServer2 to register all components in g_Templates but that function does not register source filters properly so for the moment I am just calling AMovieDllRegisterServer2 and then re-registering my filter with source filter specific code.

how to get checked value of a checkbox in a shared function

Listed below is the definition of my function (vb).
I am trying to check the value of a checkbox inside the function. I am currently unable to do this without getting an error stating that
"Error 305: Cannot refer to an instance member of a class from within a shared method or shared member initializer without an explicit instance of the class."
Is there anything I can change so that I can get the value to see that if a checkbox is checked or not? The method must be shared, so it works with the existing javascript and the use of pagemethods
Thanks
<System.Web.Services.WebMethod()> _
Public Shared Function Load(inputs here - taken out for stack overflow) As String
edit- the only other solution i can think of is to find a way for the page's javascript onload to run before the server side, this would solve my issue as well if anyone knows how this can be done.
Yes. Do what the message suggests and make the method non-shared, then you'll be able to access the members of the page.

how to find out where a property is called from unmanaged code

I have an MS ReportViewer report that is bound to a datasource, that is requesting a property that it shouldnt. I have checked all of the fields on the report and I cant find anywhere its used.
Putting a break point on the property shows its definately being called, but I cant find out from where as its the ReportViewer is making the call.
****Is there a way to find out where this property is being called from?**
Here is what I have checked so far:
Stack Trace: shows managed code, checked the disassembly but couldn't see anything obvious.
Call hierarchy shows all the places that property is called from - none of which are on the report.
Update:
Tried n8wrl's suggestion of throwing an exception, but the stack is still on unmanaged code.
Update 2
I have also tried adding Xml and Script ignore tags in case the object as being serialized somewhere but that didn't work (unless they are not the correct tags to ignore serialization?)
Ok, I have come up with a solution. I assumed this had something to do with serialization so I passed the datasource in to a System.Web.Script.Serialization.JavaScriptSerializer.
When serializing the object I found all of the properties that were causing the code to bomb out. I added [ScriptIgnore] tags to these properties to stop them begin serialized as they were not used.
System.Web.Script.Serialization.JavaScriptSerializer serializer = new System.Web.Script.Serialization.JavaScriptSerializer();
serializer.RecursionLimit = int.MaxValue;
object o = serializer.Serialize(base.CurrentOrder);

Cannot bind to list<T>.property or list<T>.item.property in details section of Telerik report

I have created a Telerik report and I am setting the datasource on runtime to an object with some properties and a List. I am using the properties in the page and report header sections and i want to use the list as the details. Now the problem is binding to the List's item properties in the details section. I have played around with the expression builder and it seems that i should access the properties like this :
[=Fields.myList.Item.myProperty]
when i run the program i get a nice big red rectangle with the following error :
An error has occured while processing TextBox 'textBox28':Common Language Runtime detected an invalid program.
I have tried to change different variants of expression which also gives me other errors
[=Fields.myList.myPropery]
An error has occured while processing TextBox 'textBox28': The expression contains object 'myProperty' that is not defined in the current context.
The closest i have gotton was with the object it self, which outputs the object.toString()
[=Fields.myList]
I found a working solution although not what i was looking for, I created my own class with properties and made a List. I then retrieved the data from the db did the changes i wanted to do in the class and set the datasource of the report to the list. This is working quite well.
I struggled with this error:
An error has occured while processing TextBox 'textBox28': The expression contains object 'myProperty' that is not defined in the current context.
The solution I came up with was to make my model object inherit from List. For example:
public class MyReportModel : List<MyEntityDto> {
}
The look of the report wizard makes it seem like this isn't necessary, but I found no other way around this error.
This is for Telerik Reporting Q3 2013.

Can I get changeWatcher to fire when XML is appended to?

So I had a requirement to add an undo function to my app and I discovered this nifty ChangeWatcher class, but it's not doing exactly what I want and I'm hoping someone knows how.
ChangeWatcher seems to monitor assignments to the variable reference. So when I say:
myXML = <xml/>
it fires off it's function just fine and dandy, but when I say:
myXML.appendChild(thisOtherXMLVar)
I get nothing, even though the variable changes the reference doesn't so ChangeWatcher doesn't fire off the function.
So does anyone know how to get ChangeWatcher to pick up on all changes to a variable?
ChangeWatcher is a really cool class. But it's not going to work unless the property you're trying to watch change is [Bindable].
If you're myXML variable is Bindable, then when you set it to the XML value, it will dispatch an event (default is propertyChange). ChangeWatcher adds an event listener to the object for whatever [Bindable] events have been declared. It does this by getting the Bindable metadata for that variable.
But the XML class itself doesn't have anything Bindable, so calling appendChild won't dispatch any events and ChangeWatcher wont work.
Updating based on your comment, you can just make all of your changes to the XML and then reset the variable. That will then cause the ChangeWatcher to register the update.
Hope that helps,
Lance

Resources