Loading OpenZoomViewer Into an SWF Fails
I'm relatively new to OpenZoom and only code Actionscript within Flash not Flex Builder. I have attempted to load an OpenZoom .swf into a sprite in another Flash project. However, it appears that some objects are not instantiated and the load fails. Since you all know the OpenZoom much better than I do you think this is possible and/or relatively easy?
Basically, I want to have OpenZoom work as a component of portfolio Flash site.
Thank you!
Basically, I want to have OpenZoom work as a component of portfolio Flash site.
Thank you!
2
people have this problem
I have this problem, too!
Tell me when someone solves it.
The more people who report this problem, the more it gets noticed.
The more people who report this problem, the more it gets noticed.
The company marked this problem solved.
The best solution from the company
-
Gentlemen,
Tom Klawsuc just emailed me, pointed out the problem and provided the solution. The code in the constructor of the OpenZoomViewer class accesses the stage right away. This obviously will fail when loading this SWF into another one. The solution is to wrap the code in the constructor into an event handler, e.g addedToStageHandler, and adding an event listener inside the constructor, i.e. addEventListener(Event.ADDED_TO_STAGE, addedToStageHandler, false, 0, true);
http://github.com/openzoom/nano/raw/m...
Cheers,
Daniel
I’m amused
The company says
this solves the problem
-
Inappropriate?Kenton,
Have you loaded an existing OpenZoom SWF into your application or did you develop your own? Could you describe the errors you were getting in more detail?
Cheers,
Daniel -
Inappropriate?Daniel,
Yes, I tried to use the example for CS3 that is included in the SDK.
The error I am seeing:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at MultiScaleImageFlashCS3Example()
It's not specific as to what it can't access. I did run trace statement from within the AS3 file and it outputs so all the files are in place as best I can tell. I'm at a bit of loss.
Thanks for you help. -
Inappropriate?Kenton,
Could you please step through your program with the debugger and tell me more specifically which reference is null?
–Daniel -
Inappropriate?Hi Daniel,
I have this problem too. I made a standalone swf by hard-coding the url for the ImageProperties.xml and that worked beautifully - would run without flashvars but when I try to load it into another swf I get
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at OpenZoomViewer/initializeKeyboardShortcuts()
at OpenZoomViewer()
Malcolm -
Inappropriate?Malcom,
Could you give me the exact reference that is null?
I suspect the problem is that stage might be null.
--Daniel -
Inappropriate?Hi Daniel,
is that not the reference that I gave above?
initializeKeyboardShortcuts()
That's where it stops executing. This is immediately after
initializeStage()
So I think you are right about the stage being null
Malcolm -
Inappropriate?Gentlemen,
Can someone please step through the problem with a debugger and exactly state what's going on? With the given information it's hard to determine what's going wrong. I would do it myself but I don't have a working setup right now.
–Daniel
-
Inappropriate?From the debugger, this is the error I am seeing:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at MultiScaleImageFlashCS3Example$iinit()
Cannot display source code at this location.
Not sure if this is useful. Thanks very much for looking into this. Let me know if any other information would be useful. -
Inappropriate?Gentlemen,
Tom Klawsuc just emailed me, pointed out the problem and provided the solution. The code in the constructor of the OpenZoomViewer class accesses the stage right away. This obviously will fail when loading this SWF into another one. The solution is to wrap the code in the constructor into an event handler, e.g addedToStageHandler, and adding an event listener inside the constructor, i.e. addEventListener(Event.ADDED_TO_STAGE, addedToStageHandler, false, 0, true);
http://github.com/openzoom/nano/raw/m...
Cheers,
Daniel
I’m amused
The company says
this solves the problem
Loading Profile...




EMPLOYEE