Note that there are some explanatory texts on larger screens.

plurals
  1. POExtending Flex FileReference class to contain another property
    primarykey
    data
    text
    <p>I want to extend the FileReference class of Flex to contain a custom property. I want to do this because AS3 doesn't let me pass arguments to functions through event listeners, which makes me feel sad, so I need this property to exist on the event target, so I can access it.</p> <p>I also want to be able to cast extant FileReference objects to this class without any fuss. I have:</p> <pre><code>var fr:SmxFR = e.target as SmxFR </code></pre> <p>and I want that to work; right now it just returns null.</p> <p>A blank, newly instantiated <code>SmxFR</code> object has the extended property in place, but all of its inherited properties and objects return <code>Error: Error #2037: Functions called in incorrect sequence, or earlier call was unsuccessful.</code></p> <p>This is the class I am using, <code>SmxFR.as</code>:</p> <pre><code>package { import flash.net.FileReference; public class SmxFR extends FileReference { public var housenum:String = ""; public function SmxFR() { super(); } } } </code></pre> <p>Kept it as straightforward as I could, really. Can someone please help me figure this out? Thanks.</p> <hr> <p>Edit:</p> <p>Per request, this is the instantiation which results in the aforementioned error in all inherited objects:</p> <pre><code>var fr:SmxFR = new SmxFR(); </code></pre> <p>I get living handle property from that, and all other (that is, inherited) properties throw <code>Error #2037</code>.</p> <hr> <p>So, maybe what I want to do is going to require overriding <code>FileReferenceList</code>? If the original objects must be instantiated to <code>SxmFR</code>, that's what I'll have to do, since I'm using FRL to allow the user to select multiple files at once. Are you guys sure there is no way to fast from a <code>FileReference</code> to my class?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload