Commit Graph

263 Commits

Author SHA1 Message Date
Ray Greenwell a9e60be7c7 Another well-thought out actionscript feature: varags!
In java, if you override a varargs method you can easily call super, you just
have to do a wee cast:

    @Override
    public Stuff getStuff (int thing, Object... args)
    {
        return super.getStuff(thing, (Object[]) args);
    }

In abjectscript:

    override public function getStuff (thing :int, ... args) :Stuff
    {
        // This doesn't work, because now 'args' to super is an array
        // containing OUR args array as its first element.
        return super.getStuff(thing, args);

        // We can fix things for super by 'apply'ing the function to
        // all the args in one array...
        args.unshift(thing);
        return super.apply(this, args);

        // But it could also be the case that someone is intentionally
        // passing an array to this method (many flash library methods take
        // varargs but also accept arrays and do this same thing).
        if (args.length == 1 && (args[0] is Array)) {
            args = (args[0] as Array);
        }
        return super.getStuff(thing, args); // super must ALSO do the unjimmying

        // OR, we could combine the two so that super doesn't have to
        // do unjimmying.
    }

As a note, there is an 'arguments' object that is secretly placed in every
function call, presumably so that callers can test whether an arg is
the default value because the user didn't pass it in or whether it's
the default because the user happened to pass in the default.
Guess yourself, because that doesn't seem worth adding as a language feature.
Anyway, the 'arguments' is not an array! You can't use it to call super
via 'apply'. It's another associative hash. God bless you actionscript,
you just make so much fucking sense.

So I made a utility method for unfucking vargs.

I bitch a lot, yes, but my bitching takes only a fraction of the time
that was wasted discovering whatever it is I'm bitching about
(this was fun to trace backwards to the source, oh yes), and maybe I
can save others some time as a result.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4477 542714f4-19e9-0310-aa3c-eee0fc999fb1
2006-12-09 00:08:09 +00:00
Ray Greenwell f9b2ef2d40 Cleaned up some wackiness that was left over from the conversion from
Java to abjectscript: substitution happens differently and the way I left
it last night was less than ideal.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4476 542714f4-19e9-0310-aa3c-eee0fc999fb1
2006-12-07 21:28:15 +00:00
Ray Greenwell ad4f36729b Import mx's StringUtil.substitute() into our own StringUtil, as it's annoying
to have two StringUtils.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4475 542714f4-19e9-0310-aa3c-eee0fc999fb1
2006-12-07 21:26:05 +00:00
Ray Greenwell 0ffa0211bc Converted the base CurseFilter to actionscript.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4474 542714f4-19e9-0310-aa3c-eee0fc999fb1
2006-12-07 03:43:18 +00:00
Ray Greenwell acdd1b543c Expanding chat services that were ommitted earlier: filtering, chatters.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4472 542714f4-19e9-0310-aa3c-eee0fc999fb1
2006-12-07 00:11:15 +00:00
Ray Greenwell e28f419b22 escape() has nothing to do with the unescape() just below it, it's used
to prepare messages before handing them off to a MessageFormat.
We don't have those in actionscript, so we don't need to prepare.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4471 542714f4-19e9-0310-aa3c-eee0fc999fb1
2006-12-06 21:19:52 +00:00
Ray Greenwell b6b7e75823 Added a convenient static dumpStack() method.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4470 542714f4-19e9-0310-aa3c-eee0fc999fb1
2006-12-06 20:21:07 +00:00
Ray Greenwell dfb4de0608 Wee Occam Jr., with his shiny oversized plastic "My First Razor"!
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4469 542714f4-19e9-0310-aa3c-eee0fc999fb1
2006-12-06 02:50:32 +00:00
Ray Greenwell d9894b6c78 I don't think jamming things into 'source' is kosher, so do it the right
way.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4468 542714f4-19e9-0310-aa3c-eee0fc999fb1
2006-12-06 02:49:41 +00:00
Ray Greenwell e15d6d31d1 Found nefarious bug (when it bit me, of course).
If a listener was removed during event dispatch, the size of the list
was shrinking and putting the kibosh on listeners at the end of the list.
(The Java side avoids this due to the different way arrays work.)
- Changed the listener and subscriber lists to simple arrays, and make
  a copy prior to dispatch so that we don't miss anybody!


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4467 542714f4-19e9-0310-aa3c-eee0fc999fb1
2006-12-06 02:48:53 +00:00
Ray Greenwell 20a9685cc4 Allow menu items to be configured with a callback function directly
(to which any args will be passed), instead of only dispatching
controller commands.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4465 542714f4-19e9-0310-aa3c-eee0fc999fb1
2006-12-01 03:06:42 +00:00
Ray Greenwell 06046aed9c DSet should be cloneable; ObjectUtil.copy() only works for registered
Externalizables or built-in classes.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4464 542714f4-19e9-0310-aa3c-eee0fc999fb1
2006-12-01 02:24:27 +00:00
Ray Greenwell 616f18546c Return true if we succeeded.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4462 542714f4-19e9-0310-aa3c-eee0fc999fb1
2006-11-27 22:06:08 +00:00
Ray Greenwell a559b48f38 Dispatch a SIZE_KNOWN event when we know our media's size.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4461 542714f4-19e9-0310-aa3c-eee0fc999fb1
2006-11-20 22:13:02 +00:00
Ray Greenwell d93d529ff8 Do not shutdown and reload if we're going to display the same URL, useful
for when this is used within another widget as a list item renderer.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4460 542714f4-19e9-0310-aa3c-eee0fc999fb1
2006-11-20 21:23:33 +00:00
Ray Greenwell 9ff4149e90 Commented out unneeded client code.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4458 542714f4-19e9-0310-aa3c-eee0fc999fb1
2006-11-18 02:32:17 +00:00
Ray Greenwell d42a8e9475 Regenerated from updated templates.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4454 542714f4-19e9-0310-aa3c-eee0fc999fb1
2006-11-15 03:00:05 +00:00
Ray Greenwell 253d8ae90c Actionscript SetAdapter.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4451 542714f4-19e9-0310-aa3c-eee0fc999fb1
2006-11-15 02:23:48 +00:00
Ray Greenwell cfddf38a67 Generic control for scrolling a display object around within its parent.
This doesn't (seem to) work quite right because of the way Flash does
handles component dimensions. It's designed to be overridden.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4450 542714f4-19e9-0310-aa3c-eee0fc999fb1
2006-11-13 22:42:38 +00:00
Ray Greenwell ff951383c3 Load images into our own security domain so that we can examine their
pixels.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4449 542714f4-19e9-0310-aa3c-eee0fc999fb1
2006-11-10 23:45:05 +00:00
Ray Greenwell 6dddf9c234 Re-enable the content mask.
Do not use getters/setters unless we're overridding one from a superclass.
The getters and setters hide implementation details: you never
know if a getter is doing massive amounts of computation, and it looks like
a simple field access. The nice parenthesis required for normal function
calls are a reminder to the coder that maybe they should stash that value
in a local variable if they're going to use it many times.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4448 542714f4-19e9-0310-aa3c-eee0fc999fb1
2006-11-10 01:32:40 +00:00
Ray Greenwell 92205abedf Temporarily turn off masking so that everyone can enjoy playing with p15n.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4447 542714f4-19e9-0310-aa3c-eee0fc999fb1
2006-11-09 18:30:46 +00:00
Ray Greenwell ce2c276d87 Implemented DisplayUtil.applyToHierarchy, because the similar function
included in the mx library is unable to cope with security errors
accessing a child.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4444 542714f4-19e9-0310-aa3c-eee0fc999fb1
2006-11-03 22:34:10 +00:00
Ray Greenwell 9ef2673464 Apparently String concatination is really cheap in AVM2, so let's just
keep things simple.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4443 542714f4-19e9-0310-aa3c-eee0fc999fb1
2006-11-02 23:53:30 +00:00
Ray Greenwell 6f18912003 Collections.shuffle().
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4441 542714f4-19e9-0310-aa3c-eee0fc999fb1
2006-11-01 03:55:14 +00:00
Ray Greenwell 91b50cd0b8 Took care of some TODOs.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4440 542714f4-19e9-0310-aa3c-eee0fc999fb1
2006-11-01 03:52:29 +00:00
Ray Greenwell b0cc50b21b - Don't actually set our width/height to that of the media we contain.
That's so "Java" of me, in actionscript children regularly have larger
  bounds than their parents (and get to display it all).
- Stronger security restrictions on loaded content. (Games will break)
- A few visits from old man Occam.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4439 542714f4-19e9-0310-aa3c-eee0fc999fb1
2006-10-31 23:46:22 +00:00
Ray Greenwell 9437211e40 We must load content into our SecurityDomain if we want its
ApplicationDomain to be a child of ours.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4437 542714f4-19e9-0310-aa3c-eee0fc999fb1
2006-10-26 21:29:13 +00:00
Ray Greenwell a9d5ca01e2 We don't need the application to be passed-in, it's always
statically accessible.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4436 542714f4-19e9-0310-aa3c-eee0fc999fb1
2006-10-26 01:49:44 +00:00
Ray Greenwell 0a89eedc6c Nixed JavaConstants.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4434 542714f4-19e9-0310-aa3c-eee0fc999fb1
2006-10-24 22:16:57 +00:00
Ray Greenwell a83c70dd0f Handle showing a resource class or an already-configured DisplayObject.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4433 542714f4-19e9-0310-aa3c-eee0fc999fb1
2006-10-23 22:47:54 +00:00
Ray Greenwell 8683642e4f Match recent changes on Java side.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4432 542714f4-19e9-0310-aa3c-eee0fc999fb1
2006-10-23 17:47:43 +00:00
Ray Greenwell 7d68d9c617 Added CommandEvent.markAsHandled().
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4430 542714f4-19e9-0310-aa3c-eee0fc999fb1
2006-10-18 01:38:48 +00:00
Ray Greenwell 4a537cadeb Unstream lists as Arrays.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4422 542714f4-19e9-0310-aa3c-eee0fc999fb1
2006-10-11 21:30:56 +00:00
Mark Johnson 47d1369180 A psudo random number generator that can be seeded. Use at your own
risk.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4415 542714f4-19e9-0310-aa3c-eee0fc999fb1
2006-10-05 22:27:06 +00:00
Michael Bayne 19fa31cdba Don't implement subList() as in Java this is a view and we can't do that easily
in ActionScript without ubercomplexity. So we'll rewrite the code that was
using it.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4409 542714f4-19e9-0310-aa3c-eee0fc999fb1
2006-10-05 00:24:20 +00:00
Michael Bayne 626b4d257f Added some methods to StreamableArrayList that behave properly (use Equalable
to determine equality instead of using reference equality).


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4407 542714f4-19e9-0310-aa3c-eee0fc999fb1
2006-10-05 00:16:11 +00:00
Michael Bayne e99ac5762d Regenerated all of the ActionScript services using the new code generation tool.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4401 542714f4-19e9-0310-aa3c-eee0fc999fb1
2006-10-04 20:41:51 +00:00
Michael Bayne 3305c1b922 Our inherited constructor documentation didn't make much sense.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4396 542714f4-19e9-0310-aa3c-eee0fc999fb1
2006-10-04 02:17:35 +00:00
Michael Bayne 398767da5f Ran the auto-generator on all our Streamable stuff in Narya. Tidied up the
results.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4395 542714f4-19e9-0310-aa3c-eee0fc999fb1
2006-10-04 02:07:04 +00:00
Ray Greenwell 572d5a6555 Oop, we'll want to immediately Stringify any args passed to our constructor,
as well.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4391 542714f4-19e9-0310-aa3c-eee0fc999fb1
2006-10-04 01:20:13 +00:00
Ray Greenwell 5e769376f2 Stringify an added element at the time it is added, not at the time
that toString() is called on the buffer.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4390 542714f4-19e9-0310-aa3c-eee0fc999fb1
2006-10-04 01:15:15 +00:00
Ray Greenwell 23f6486bf7 Added clarifying comments.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4389 542714f4-19e9-0310-aa3c-eee0fc999fb1
2006-09-29 18:40:41 +00:00
Ray Greenwell bd8ee0fd4d Bugfix: return undefined, not null, to indicate absence in the map.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4386 542714f4-19e9-0310-aa3c-eee0fc999fb1
2006-09-28 19:11:17 +00:00
Ray Greenwell f544a76b62 Added the ManagerCaller that was added a while back on the Java side.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4385 542714f4-19e9-0310-aa3c-eee0fc999fb1
2006-09-27 23:54:40 +00:00
Ray Greenwell 0650d58006 Improved the debug-mode logging a bit.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4384 542714f4-19e9-0310-aa3c-eee0fc999fb1
2006-09-27 23:54:09 +00:00
Ray Greenwell 2a71f0c9bc Added getTinyClassName().
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4381 542714f4-19e9-0310-aa3c-eee0fc999fb1
2006-09-27 00:31:03 +00:00
Ray Greenwell a3213cdee2 Automatically unwrap any result object that is wrapped.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4377 542714f4-19e9-0310-aa3c-eee0fc999fb1
2006-09-24 23:51:33 +00:00
Ray Greenwell 036271438a Some bits: made the actionscript Observer list cope and furthermore
keep all observers in the list if the 'apply' function you specify
returns void.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4374 542714f4-19e9-0310-aa3c-eee0fc999fb1
2006-09-14 01:48:09 +00:00
Ray Greenwell f4e7fd73f6 Commented out upstream methods for classes that will never use them.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4367 542714f4-19e9-0310-aa3c-eee0fc999fb1
2006-09-11 20:19:11 +00:00