A Flash Developer Resource Site

Results 1 to 11 of 11

Thread: Change a function's function?

  1. #1
    Junior Member
    Join Date
    Jan 2001
    Posts
    28
    Hi guys,

    is there a way how I can change a function's
    function.
    When I call the getURL(), flash should not open
    the URL, it should set a Variable to a value.
    i.e.

    getURL("Hello World");

    current ---> open Browser with the document Hello World (wrong)
    should ---> set variable "foo" to "Hello World" (thats what I need)

    Maybe with some OOP, but I don't no how.

  2. #2
    Senior Member Leo Lima's Avatar
    Join Date
    Jul 2000
    Location
    São Paulo, Brazil
    Posts
    745
    You can do that directly with
    Code:
    foo = "value"
    but if you're dying to get a function, you can write a function like this one that's for level0
    Code:
    function changeValue (variable, value) {
      this[variable] = value;
    }
    changeValue ("foo", "value")/
    Now that you mentioned it, why in lots of books about Perl they use "foo" and "bar" and such? I never knew...

  3. #3
    Junior Member
    Join Date
    Jan 2001
    Posts
    28
    Thanks,
    but no, no, no not it's not that easy way

    What I mean is to override the getURL function.
    When I add getURL("Hello World") to a button
    it should not open a window, it should set a
    variable to "Hello World". So the normal function
    (open a browser doc) of getURL is no longer available.

    U understand me?

  4. #4
    Senior Member Leo Lima's Avatar
    Join Date
    Jul 2000
    Location
    São Paulo, Brazil
    Posts
    745
    I did before, but don't see why.

  5. #5
    Junior Member
    Join Date
    Jan 2001
    Posts
    28
    Again.

    I don't need a simple function like

    function changeValue (variable, value) {
    this[variable] = value;
    }
    changeValue ("foo", "value")/

    I would disable the getURL function of
    flash.
    Why? Ok I try to say it short:
    I got an engine (swf file) where other
    people can add their swf animations, but
    they are not allowed to set links (use getURL)
    in it.
    You understand what I mean?

  6. #6
    Junior Member
    Join Date
    Jan 2001
    Posts
    28
    What's up guys?
    Is the nut to hard for you

  7. #7
    Senior Member Leo Lima's Avatar
    Join Date
    Jul 2000
    Location
    São Paulo, Brazil
    Posts
    745
    Well, I wish you good luck. I'd never know how to do that. I've never needed...

  8. #8
    psx = new Moderator();
    Join Date
    Jan 2001
    Posts
    923
    hmmm. I thought it would be possible with prototyping, but not quite. adding something like this:

    MovieClip.prototype.getURL = function (param) { trace (param); };

    works, but only if you call getURL like so:
    this.getURL();

    Unfortunately, there is never any need to do that, so I wouldn't expect any of your users to code their buttons like that.

    Special thanks to Phillip Kerman for his input!

    Psx

  9. #9
    Junior Member
    Join Date
    Jan 2001
    Posts
    28
    Thanks, psychlonex.

    That was the way I tried but it won't work.
    Isn't a realy flashguru out there?

  10. #10
    Junior Member
    Join Date
    Jan 2001
    Posts
    28
    Ok I see,
    nobody knows it.

    Let's try it this way:
    Can I execute a function in Flash using GETURL?
    Maybe like asfunction in HTMLinFLASH. I know
    FSCOMMANDS are a way, anything else?

  11. #11
    Registered User
    Join Date
    Feb 2001
    Posts
    13,041
    Hi AlanSutter,

    there is no way in actionscript. While "this.geturl" could probably be trapped, the plain geturl function is present in the swf as an alementary opcode (like "+" or "=" functions)
    You could, however, have a script on the server that checks the uploaded file and rejects it if there is any geturl inside.
    A potential problem: there may be legitimate uses for loadmovie from an outside server, but if you allow that, you will have to scrutinize those movies as well.

    Musicman

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center