Using TextSnapshot class on a loaded SWF on an iPad

Hello, I am creating an iPad app. I am loading SWF files using a Loader object, then placing them in a movieclip and setting a SWFLoaders source property to this clip. Before I add the clip to the SWFLoader control I am using the TextSnapshot class on it, to retrieve an array with the getTextRunInfo method.
All this works fine when I test it on my desktop machine. However, on the iPad it causes the app to crash when a control using this clip is added to the stage. Can you still use TextSnapshot with an iPad, is there a workaround for this? Thanks for your help.

We are a university. most of our books are SWF files. We have been using iPad/FlexBuilder 4.5 to successfully view the contents of these books.
All navigation (i.e gotoandstop(page), etc work fine. Gestures for pageforward/pageback, zoom, pan work fine also.
Not sure I understand your comment.
However, there IS a specific problem with text snapshot. Below is a short code piece used to highlight text on a page.
If you remove the failing line everything works fine.
If you "debug" the iPad device everything works fine when you execute the code on the iPad
if you create a release build, when the application starts and the "findtext" line is executed the "app" freezes. No error message. The try/catch does not seem to catch any error.
This is something we really need for our app. If this is a bug how should we report it.
Thanks for your help.
  public function highlightText(txt:String):void {
   var start_pos:int = 0;
   try {
    if (txt == null || txt.length == 0) { return; }
    infoMessage("highlightText: " + txt);
    allText = _libMC.textSnapshot;      
    allTexts.push(allText);  // no reason for this but must do to make work 
    start_pos = allText.findText(start_pos, txt, false);     <<<<<< Failing line ====================================
    infoMessage("start_pos: " + start_pos);
   catch (err:Error) {
    infoMessage("error: " + err.message);   
   finally {
    infoMessage("finally");

Similar Messages

  • Accessing a class from a loaded SWF

    In Flash Professional, I drew a shape, converted it to symbol, linked it to class Symbol1 (extends MovieClip) which is generated at run-time, and saved the SWF file as shape.swf.
    Now my main application wants to load shape.swf and create multiple instances of Symbol1 but I get ReferenceError when trying to access the class Symbol1.
    Below is my main application's code. Errors thrown are mentioned in comments.
    public class MovieClipTest extends Sprite
        public function MovieClipTest()
            var url:String = 'shapes.swf';
            var l:Loader = new Loader();
            l.contentLoaderInfo.addEventListener(Event.COMPLETE, f);
            l.load(new URLRequest(url), new LoaderContext(false, ApplicationDomain.currentDomain));
        private function f(event:Event):void
            var content:Sprite = (event.currentTarget as LoaderInfo).content as Sprite;
            trace(getQualifiedClassName(content.getChildAt(0))); // output: Symbol1
            trace(ApplicationDomain.currentDomain.getDefinition('Symbol1')); // throws Error #1065: Variable Symbol1 is not defined.
            trace(getDefinitionByName('Symbol1')); // throws Error #1065: Variable Symbol1 is not defined.

    Your "Symbol" is obviously not in the current ApplicationDomain, but in the loaded SWF's domain:
    var symbolClass:Class = event.target.applicationDomain.getDefinition("Symbol") as Class;
    var symbolInstance:MovieClip = new symbolClass() as MovieClip;
    Also because you're loading a SWF, the content of the Loader is a MovieClip, not a Sprite.
    Kenneth Kawamoto
    http://www.materiaprima.co.uk/

  • GetDefinitionByName not finding class in externally loaded SWF

    In my app, I have an external SWF that contains a bunch of
    movie clips that I want to instantiate in my main swf.
    I have checked the "Export for ActionScript" and the "Export
    in first frame" box in the movie clip in Flash.
    In my main SWF, I have action script code that loads the SWF
    (using the normal Loader and URLRequest classes).
    When the load completes, I do:
    var loader:Loader = Loader(event.target.loader);
    var movieClip:MovieClip = MovieClip(loader.content);
    var theClass:Class;
    try
    theClass = Class(getDefinitionByName("TestClass"));
    catch(e:Error)
    trace("TestClass not found!");
    return;
    I have never gotten it to successfully find the class.
    Is there anything else I might be doing wrong?
    Thanks

    Ah, I figured it out. I need to use the applicationDomain. So
    instead of using getDefinitionByName, I would call:
    event.target.applicationDomain.getDefinition("TestClass");
    That seems to work....
    Thanks

  • I have been using the kindle app to load books on my ipad. For the past two days I cannot access those books. I might get one page to show then the screen will freeze and I can't turn the page. Does anybody know what is going on. Help!

    For the past two days I cannot access my kindle books on my ipad. I might be able to get one page of a book to appear but then it freezes and I can't turn the page. I tried turning my ipad completely off and then on again. Any ideas to fix this?

    Start by doing a reset ,you will not lose any data
    hold home /sleep button until Apple logo appears  ignore off slider
    first try closing Kindle App on iPad

  • Loading class from an external .swf file

    Hi,
    My flash application has lots of resources which will change all the time. In order to keep the the user from having to download my main .swf file over and over again, and in order to keep the main file's size low, I would like to put the resources into separate .swf files and load them dynamically from a url using a Loader.
    Once downloaded I would like to extract the classes that are in the resource swf and use them in the main swf. Can anyone share some code for doing this? Note that I am not just interested in using a symbol from the resource swf. I would like to use a class, with all of its methods and everything, and my main swf does not contain the class definition. Only the resource swf does.
    Thanks!!

    This is a great question for flash programming.
    And when you know the answer to this, you are likely to use it on daily basis like the top level programmers  of an agency.
    ApplicationDomain is your answer and the adobe docs has a chapter on this.
    ApplicationDomain is where all of your classes will be loaded into and when you use a loader you have the ability to target this with the laoderContext.
    AplicationDomain.currentDomain loads all classes into the main app and if your main app already has these classes, then the app uses the parents classes
    new Application.Domain() specifies a seperate repo of classes that are loaded in so that classes in the main app will not be confused by the classes in a loaded swf. that refer to the same names.
    this locks down the communication between the swfs but will use the newer updated classes on the child when a child is loaded in with the same class names as the parents.
    new ApplicationDomain(currentDomain)  will enclose a new repo with the parent repo of the class definitions.

  • Pass parameters to a function in main class from loaded SWF?

    I've got a main.as that loads SWF to the stage.
    the loaded SWF seppoused to pass a link to the main.as and trigger a javascript function to popUp that photo from that link.
    I know there are two ways:
    ((root as MovieClip).parent.parent as Object).somefunction(parameters);
    and to dispatch an event.
    inorder to pass parameters throug the event i need to extend it with another class.
    isnt the (root as... )  more efficient if all i need is to pass a link?

    when a photo from the gallery is selected a javascript popUp shows it enlarged with additioan editing options (kinda like in facebook).
    in that popUp ther is also a next button so its kinda bidirectional. (the next calling the loaded SWF throug main to get the next link in the photo array)
    the photo is a grandchild of a grandchild of the stage and the loaded swf is a grandchild so using:
    ((root as MovieClip).root as MovieClip).ExternalInterface.call("ShowPic", link);
    is discusting ><

  • Invoking class from loaded swf

    I'm working on a project where I'm loading in a video player
    as an external swf to my main movie. I'm not able to get my video
    or the custom player to show up, but sound is there (I've done the
    whole Library>New Video thing, so I have a video object to
    reference).
    My question is: My loaded swf uses #include to include a
    script which imports two classes from a subdirectory, could that be
    causing the problem? My main movie never uses the classes.
    Just want to make sure this isn't my problem before I go
    digging into the script again!

    That is unlikely to be the problem. The .as includes are
    compiled into the
    SWF at publish. Much more likely is that you have
    inappropriate references
    to _root in your loaded movie. As it stands, the scope of
    _root, once you
    load the movie into another, is the _root of the *loading*
    movie. Either
    change these refs, or set the _lockroot property of the mc
    you are loading
    into to true.,
    Remove '_spamkiller_' to mail

  • Access the property of main class in loaded swf.

    Hi
    i have one main.fla, its document class is main.as. the code in main.as is
    package
    import flash.display.MovieClip;
    public class Main extends MovieClip
    private var loading:Loading;
    public var trovami:Number=10;
    public function Main()
    stage.frameRate=31;
    loadSWF();
    private function loadSWF():void
    loading=new Loading(this);
    Loadind.as is another class where i load another swf its name is my_swf.
    the code of loading class is:
    package
    import flash.display.MovieClip;
    import flash.display.SimpleButton;
    import flash.text.TextField;
    import flash.display.Loader;
    import flash.events.*;
    import flash.net.URLRequest;
    public class Loading extends MovieClip
    private var _fla:MovieClip;
    private var url:String;
    public var val:String;
    private var loader:Loader;
    public function Loading(fla:MovieClip)
    _fla=fla;
    init();
    private function init():void
    url='my_swf.swf';
    var request:URLRequest=new URLRequest(url);
    loader=new Loader();
    initListeners(loader.contentLoaderInfo);
    loader.load(request);
    private function initListeners(dispatcher:IEventDispatcher):void
    dispatcher.addEventListener(Event.COMPLETE,completato);
    private function completato(event:Event):void
    _fla.addChild(loader);
    loader.y=10;
    val="hello"
    and the document class of loaded swf is Main2. in my_swf.fla there is one text its name is:
    a_txt.
    so i have to use property of Loading class in Main2 for text.
    code of Main.as is
    package
    import flash.display.MovieClip;
    import flash.text.*;
    public class Main2 extends MovieClip
    public function Main2()
    a_txt.text=val;
    where val is the property of Loading class.
    so how can i access.

    You have a reference to your loaded movie within your Loading class - instead of just setting val to a string - add a method in your Main2 class - and call that from Loading - passing the string to it. Push not pull...
    Main 2 becomes:
    public function Main2() {
         //a_txt.text=val;
    public function setText(val:String):void {
        a_txt.text = val;
    And then in your Loading class - when you're done loading just call setText:
    private function completato(e:Event):void
        addChild(loader);
        loader.y=10;
        MovieClip(loader.content).setText("hello");
        //val="hello";

  • Using embeded fonts in loaded swf.

    I have a .Swf, which has 3 fonts embedded in it, they are all exported in frame 1 for AS.  This swf loads any number of external .swfs which have dynamically generated textfields inside of them.  This text must be embedded text because effects may be applied to them.  I do not want to embed the three fonts into every external swf, and do not think I should have to.  The font exists in the Loading swf and I have registered the fonts to the global font list.  If I print this list from the loaded swf, all three fonts are present, but when I try to use any of them, my textfiels are empty.
    My question is how do I utilize a font which is embedded in a swf, from a swf which has been loaded into that swf?
    From my external swf, this code:
    [PHP]var embeddedFonts:Array = Font.enumerateFonts(false);
    embeddedFonts.sortOn("fontName", Array.CASEINSENSITIVE);
    trace(embeddedFonts);[/PHP]
    produces the following:
    [PHP][object CenturyBook],[object MyriadProRegular],[object MyriadProItalic][/PHP]
    which are the three fonts that are embedded in the loading swf, So I assume the LOADED swf has access to these fonts.
    When I apply this code to the externally loaded swf:
    [PHP]var FontClass:Class = getDefinitionByName("MyriadProRegular") as Class;
    trace("FontClassInstance -> " + FontClass.toString());
    var linkedFont: Font = new FontClass();
    trace("Font name: " + linkedFont.fontName);
    var textFormat: TextFormat = new TextFormat(linkedFont.fontName, 14);
    //... The next lines set up the text box and apply the format.  I am sure this is done correctly.
    [/PHP]
    I get the following output:
    [PHP]FontClassInstance -> [class MyriadProRegular]
    Font name: Myriad Pro[/PHP]
    which is exactly what I would expect.  Yet, my text box is still blank.  I have embedText = true on the text box, and have applied a string to the "text" property, so it's nothing silly liek that.
    Any help would be appreciated...

    You may also want to look at the various embedded font format issues. Many of the Flex 4 components use a newer embedded font fortmat, which is not the same as the one generally used in Flash. So even if ther Flash font gets registered properly, it still may not work with some of the spark components.
    You should be able to create a swf using Flex that contains fonts embedded in either format, which can then be used in the way you describe, though, since Flex 4 suports both font formats.
    Hopefully, someone else will jump in here if I got some of this wrong.
    -JM

  • Loading SWFs: Classes do not match

    I've written an AIR app which loads coompiled SWFs and manipulates them.  The problem I've run into is that I cannot access the custom objects in the SWF because their class definition does not match the class definition in the AIR app.
    I have a library project that I develop all the classes in.
    The SWFs are published from Flash using the Source Path of this library, and the AIR app has the library project listed in its Build Path Libraries in FB 4.5.
    Example:  vManager is a ViewManager, a custom class used in the SWF to do various things.  It is accessible to the AIR runtime, but the AIR runtime thinks it's some other class that doesn't exist anymore:
    From the AIR runtime:
    trace(describeType(contentMC.vManager).toXMLString());
    <type name="gdit.controls::ViewManager" base="Object" isDynamic="false" isFinal="false" isStatic="false">
      <extendsClass type="Object"/>
      <constructor>
        <parameter index="1" type="flash.display::DisplayObjectContainer" optional="false"/>
      </constructor>
      <accessor name="state" access="writeonly" type="gdit.controls::ViewStateButton" declaredBy="gdit.controls::ViewManager"/>
      <accessor name="directiveText" access="writeonly" type="gdit.controls::IndexedTextField" declaredBy="gdit.controls::ViewManager"/>
      <accessor name="states" access="readonly" type="__AS3__.vec::Vector.&lt;gdit.controls::ViewStateButton>" declaredBy="gdit.controls::ViewManager"/>
      <method name="addViewState" declaredBy="gdit.controls::ViewManager" returnType="void">
        <parameter index="1" type="flash.display::Sprite" optional="false"/>
        <parameter index="2" type="Array" optional="false"/>
      </method>
      <method name="setDefaultViewState" declaredBy="gdit.controls::ViewManager" returnType="void">
        <parameter index="1" type="Array" optional="false"/>
      </method>
    </type>
    From the SWF:
    trace(describeType(vManager).toXMLString());
    <type name="gdit.controls::ViewManager" base="Object" isDynamic="false" isFinal="false" isStatic="false">
      <extendsClass type="Object"/>
      <constructor>
        <parameter index="1" type="flash.display::DisplayObjectContainer" optional="false"/>
      </constructor>
      <variable name="defState" type="String">
        <metadata name="__go_to_definition_help">
          <arg key="file" value="G:\Flash\ASLib\src\gdit\controls\ViewManager.as"/>
          <arg key="pos" value="527"/>
        </metadata>
      </variable>
      <accessor name="state" access="readwrite" type="gdit.controls::ViewStateButton" declaredBy="gdit.controls::ViewManager">
        <metadata name="__go_to_definition_help">
          <arg key="file" value="G:\Flash\ASLib\src\gdit\controls\ViewManager.as"/>
          <arg key="pos" value="2302"/>
        </metadata>
        <metadata name="__go_to_definition_help">
          <arg key="file" value="G:\Flash\ASLib\src\gdit\controls\ViewManager.as"/>
          <arg key="pos" value="2378"/>
        </metadata>
      </accessor>
      <accessor name="defaultState" access="readonly" type="__AS3__.vec::Vector.&lt;flash.display::DisplayObject>" declaredBy="gdit.controls::ViewManager">
        <metadata name="__go_to_definition_help">
          <arg key="file" value="G:\Flash\ASLib\src\gdit\controls\ViewManager.as"/>
          <arg key="pos" value="577"/>
        </metadata>
      </accessor>
      <accessor name="states" access="readonly" type="__AS3__.vec::Vector.&lt;gdit.controls::ViewStateButton>" declaredBy="gdit.controls::ViewManager">
        <metadata name="__go_to_definition_help">
          <arg key="file" value="G:\Flash\ASLib\src\gdit\controls\ViewManager.as"/>
          <arg key="pos" value="694"/>
        </metadata>
      </accessor>
      <accessor name="directiveText" access="writeonly" type="gdit.controls::IndexedTextField" declaredBy="gdit.controls::ViewManager">
        <metadata name="__go_to_definition_help">
          <arg key="file" value="G:\Flash\ASLib\src\gdit\controls\ViewManager.as"/>
          <arg key="pos" value="3075"/>
        </metadata>
      </accessor>
      <method name="addViewState" declaredBy="gdit.controls::ViewManager" returnType="void">
        <parameter index="1" type="flash.display::Sprite" optional="false"/>
        <parameter index="2" type="Array" optional="false"/>
        <metadata name="__go_to_definition_help">
          <arg key="file" value="G:\Flash\ASLib\src\gdit\controls\ViewManager.as"/>
          <arg key="pos" value="1220"/>
        </metadata>
      </method>
      <method name="setDefaultViewState" declaredBy="gdit.controls::ViewManager" returnType="void">
        <parameter index="1" type="Array" optional="false"/>
        <metadata name="__go_to_definition_help">
          <arg key="file" value="G:\Flash\ASLib\src\gdit\controls\ViewManager.as"/>
          <arg key="pos" value="1577"/>
        </metadata>
      </method>
      <metadata name="__go_to_ctor_definition_help">
        <arg key="file" value="G:\Flash\ASLib\src\gdit\controls\ViewManager.as"/>
        <arg key="pos" value="793"/>
      </metadata>
      <metadata name="__go_to_definition_help">
        <arg key="file" value="G:\Flash\ASLib\src\gdit\controls\ViewManager.as"/>
        <arg key="pos" value="193"/>
      </metadata>
    </type>
    Both of these statements trace in  the AIR runtime.  Note that the SWF class is much larger:  this is because the AIR version is referencing a class definition that is roughly 4 versions old.
    I've tried wiping out the class def after publishing the SWF, and the AIR app still refers neither the current version of the class in the Library project, nor the version compiled in the SWF. 
    There are no errors or warnings in the Lib project, the main AIR project, or the SWF.  I've tried cleaning both projects, referencing the SWC directly, nothing seems to correct this issue.
    Maybe I'm integrating the library project incorrectly in FB?  I don't know, but if anyone does:  please let me know!
    Thanks

    Thanks for your response.
    I am still not clear. Print method is a implementation of the pageable interface why does PrintBlank implement Printable. what shows the print method is a implimentation of method of pageables Is the Print method part of class PrintBlank . I see that it is outside of the brackets of PrintBlank .
    also is the order of process class PrintBlank calls PrintJob's print method this does not take any paramters.
    PrintJob then calls Pageable's print method which sends the parameters Graphics g, PageFormat format and int pageIndex.
    Thanks

  • How can I make server use single class loader for several applications

    I have several web/ejb applications. These applications use some common libraries and should share instances of classes from those libraries.
    But applications are being deployed independently thus packaging all them to EAR is not acceptable.
    I suppose the problem is that each application uses separate class loader.
    How can I make AS use single class loader for a set of applications?
    Different applications depend on different libraries so I need a way that will not share library for all applications on the domain but only for some exact applications.
    When I placed common jar to *%domain%/lib* - all works. But that jar is shared between all applications on the domain.
    When I tried to place common jar to *%domain%/lib/applibs* and specified --libraries* attribute on deploying I got exception
    java.lang.ClassCastException: a.FirstDao cannot be cast to a.FirstDaoHere http://download.oracle.com/docs/cd/E19879-01/820-4336/6nfqd2b1t/index.html I read:
    If multiple applications or modules refer to the same libraries, classes in those libraries are automatically shared.
    This can reduce the memory footprint and allow sharing of static information.Does it mean that classes should be able to be casted ?

    You didn't specify which version of the application server you are using, but the config is similar as long as you know what to look for. Basically, you need to change the classloader delegation. Here's how it is done in 8.2
    http://download.oracle.com/docs/cd/E19830-01/819-4721/beagb/index.html

  • Using loadMovie to load SWF linked to FLV

    I am having problems getting a movie (SWF) with an linked FLV
    file to play when I use loadMovie to load it in.
    I have an .FLV file named vid_9.flv. I have embedded it into
    a Flash movie named vid_9.swf using Flash 8 Professional. I am
    using "Progressive Download from a Web Server" and no controls.
    When I play the SWF on the stand-alone player (the FLV is in the
    same folder) it works great. Now when I call that SWF into another
    movie using
    swfHolder.loadMovie("SWFs/vid_9.swf");
    it shows it being completely loaded, but then never plays,
    all I get is a white screen. This is my second project in a row
    where this did not work. Any ideas as to why? Thanks for any
    help.

    onLoadComplete executes before the loaded swf's assets are initialized:  use onLoadInit.
    those function definitions in your loaded swf should NOT be in an onLoad method.  if they are defined on the main timeline of the loaded swf, use:
    var url:String = "scene05.swf";
            var movieClip:MovieClip = createEmptyMovieClip("movieClip", 0);
            var listenerObj:Object = new Object();
            listenerObj.onLoadInit = function (target_mc:MovieClip):Void {
                //It should execute these functions that are located in the onLoad event in the loaded swf.
                target_mc.initBackground();
                target_mc.initBackgroundWeg();
                target_mc.initVehicles();
                target_mc.initForeground();
                target_mc.initKnoppen();
            var movieClipLoader:MovieClipLoader = new MovieClipLoader();
            movieClipLoader.addListener(listenerObj);
            movieClipLoader.loadClip(url, movieClip);

  • Using the DateField in an Externally loaded SWF

    Hello,
    I have been having major trouble trying to get a basic PHP
    contact form to work within an externally loaded SWF file inside of
    a parent SWF. When I test the movie on its own it seems to work
    fine (example: I'm able to select a date from the DateField
    component). However, when I open up the parent SWF file and call
    the external SWF file with the form the DateField is basically
    unusable (example: when you click on it nothing happens, no
    calendar pops up to select a date).
    I have no ActionScript on it yet, simply because I figure I
    need it to work before I tell it what to do with the PHP file. The
    instance name on the DateField is "theDate". Any help is very much
    appreciated. Thank you.
    Also, I have just successfully used the contact form on the
    web. But, the only user interface components I am able to edit are
    the input text boxes, not the DateField or the ComboBox I have in
    it as well. This is very odd, I was not aware that anything special
    had to be done using these UI components within an external file.
    Elijah

    Hello 2m,
    Maybe if you were to see it, it may help you out a bit. If
    you
    click
    here for the external file you will see that the components are
    working. However, if you
    click
    here for the parent file and then click on "Meetings" on the
    top menu you will see that they do not work at all. However, if
    someone were to hit the "send" button, the PHP code would actually
    interact with the form. Let me know if that helps at all. Thanks
    again for replying.
    Elijah

  • Using Loader.loadBytes - specify SecurityDomain for loaded swf?

    Hi i have a problem.
    I use Loader.loadBytes to dynamically load a swf into my app (i use this method to load modules into the app). My trouble is that when I want to use ExternalInterface.addCallback to allow js calls on my app. When those functions get called a SecurityError gets thrown because I'm not in the right Security Domain. Trying to set the SecurityDomain of the loaded content via LoaderContext results in another error telling me that SecurityDomain can't be other than null. Is there a way to actually get my modules accessible from JS?
    *Note:
    I have set in my main ap (the one that instantiates the module controller that loads the modules) the following:
    Security.allowDomain("*");
    Security.allowInsecureDomain("*");
    the loading code:
    var _contextLoader : LoaderContext = new LoaderContext(false, ApplicationDomain.currentDomain);
    _contextLoader.allowCodeImport = true;
    _moduleLoader.loadBytes(moduleBytes, _contextLoader);
    The error:
    SecurityDomain 'null' tried to access incompatible context ...

    The loaded swf is at loader.content, but you can only access
    it once the loading has completed and the loader has been added to
    the display list. For example, CODE 1 will not work, but CODE 2
    will.
    //CODE 1
    var myLoader:Loader = new Loader();
    addChild(myLoader);
    myLoader.load(new URLRequest("movie.swf"));
    var loadedSwf:MovieClip = MovieClip(loader.content); //ERROR
    //CODE 2
    var myLoader:Loader = new Loader();
    addChild(myLoader);
    myLoader.load(new URLRequest("movie.swf"));
    myLoader.contentLoaderInfo.addEventListener(Event.COMPLETE,
    loadCompleted);
    var loadedSwf:MovieClip;
    function loadCompleted(ev:Event):void {
    loadedSwf = MovieClip(loader.content);
    trace(loadedSwf);
    PS. I recommend using the Tweener library for tweening in
    ActionScript. It is much better than the Adobe functions and there
    is a tutorial at:
    http://gotoandlearn.com/player.php?id=45

  • Detecting when exception was thrown using custom class loader

    Hello all,
    I would like to implement the solution described here - http://stackoverflow.com/questions/75218/how-can-i-detect-when-an-exceptions-been-thrown-globally-in-java - that uses custom class loader in order to detect when an Exeption thrown somewhere in the JVM hosting my app, please note that exceptions might be thrown from 3rd party jars the app is using. So, thanks to help I got from another post, I've managed to code the custom class loader. My question is how can the class loader wrap the original exception, as the methods in ClassLoader deals with classes, not instances. So where should I set the original exception?
    Thanks!
    Edited by: user9355666 on Sep 28, 2010 10:48 PM

    user9355666 wrote:
    I think I'm missing something fundumental, forgive me for being slow...
    This is what I did so far. For the exception wrapper I made a simple class extens Exception that recieve Exception in its ctor and store it. I also subclassed ClassLoader and override its loadClass(). I've registered it as the system classloader. My thinking was to check in that point that if the requested class is instance of Exception and if yes, returning my wrapper class wrapping this exception. But, since loadClass() return class, how can I set in the wrapper the original exception?
    In addition, let's say 2 different places in the code throws NPE, to my understanding the classloader will load NPE only once, so how throwing the NPE in the second time can be detected?you are missing a key point. you should creating a custom implementation of the NPE class which hooks into your detection code in its constructor. from that point forward, anytime any NPE (which is your custom class) is constructed, you can detect it.

Maybe you are looking for

  • Graphics-heavy pdfs will not printer to any type of printer.

    They send back an error message as displayed below or they do not prints. This happens in both Mavericks and Yosemite, for both Preview and Adobe Reader, our organization's primary pdf Readers. It only seems to apply to the .pdf or similar formats, a

  • Acrobat printer stops working

    I am seeing a problem where the Acrobat virtual printer stops working after my system has been running for a while.  The symptom is that when printing to the virtual printer, the file appears in the queue, then disappears as if it was successfully pr

  • Movie rental time limit: 24 hours not enough?

    If I am in the middle of watching a movie and the 24 hour limit is up, does the movie just quit or will it keep playing until it's finished? And is it just me, or is 24 hours not long enough? Suppose at 7:00 I decide to rent Cinderella for the kids,

  • Hierarchy Results

    I have a problem with the results being returned for a hierarchy. The hierarchy is based on 0costcenter and it is used to identify, in effect, a headcount. The problem I have is that for the first 6 nodes of the hierarchy, the results are bringing ba

  • ..:: on getting 2 combo boxes to bind to single components?  --  (based on xcTrips XML tut)

    <<<<<<<PLEASE SKIP TO THE REPLY>>>>>>>> Ive built an app using the xcTrips tutorial from the flash xml resource page. It works great. (Links if needed-->) http://download.macromedia.com/pub/developer/xml_connector.zip http://www.adobe.com/devnet/flas