Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3334472
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T23:54:32+00:00 2026-05-17T23:54:32+00:00

I am facing a challenge and don’t know how to solve this in jQuery.

  • 0

I am facing a challenge and don’t know how to solve this in jQuery.

My purpose is to write an extended function replacing the Facebook callSWF function.

Facebook callSWF run like that:   **domObj.callSWF("myFunctionName", param1, param2 ... paramx);**

Now, I need to replace that function. For jQuery, I can call the Flash via JS like that:

if($('#swfObj')[0])
 {
  $('#swfObj')[0].myFunctionName(param1, param2 ...);
 }
 else
 {
  $('#swfObj').myFunctionName(param1,param2 ...);
 }

However, that means I have to change for 50+ different places that previous call “callSWF” and replace with this block of code with different function names. that’s no good.

so, I decide to write an extension. ideally, i can call like this:

$(‘#swfObj’).callSWF(“myFunctionName”, param1, param2 …);

I start writing the function and stuck…. here is my code so far:

(function( $ ){
  $.fn.callSWF = function(swfFuncName, param1) {

 if($(this)[0])
 {
  $(this)[0].**swfFuncName**(param1);
 }
 else
 {
  $(this).**swfFuncName**(param1);
 }

 return this;
  };
})( jQuery );

The part that I don’t know how to do is… to dynamicially pass in the function name (which is the swf function name). so, the swfFuncName will be different depending on the flash function that I’m going to communicate with.

e.g i can do that:

**$('#swfObj').callSWF("showMyName", 'whatever');**
**$('#swfObj').callSWF("anotherFunction", 1234);**
**$('#swfObj').callSWF("yetAnotherFunction", 'kbieure');**

any idea? thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T23:54:33+00:00Added an answer on May 17, 2026 at 11:54 pm

    The key is simply to use what most would call “array” syntax instead of “object” syntax to reference the appropriate property of $(this)[0] or $(this) (as the case may be)

     if($(this)[0])
     {
      $(this)[0][swfFuncName](param1);
     }
     else
     {
      $(this)[swfFuncName](param1);
     }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm facing a problem with IE6. I took the toggle function from this website
I'm facing a design challenge that I just can't seem to solve in a
Friends, I'm facing another challenge in APEX and I hope you can help. I
I'm facing a new challenge here. I can't seem to find precedence for replication
I'm facing the following challenge: I have a bunch of databases in different geographical
I'm looking for some input for a challenge that I'm currently facing. I have
I'm using MS SQL 2008 and I'm facing a challenge for a few day's
Please bear with me -- I know this is complex. I have a table
i'm facing a challenge of rebrushing and updating an almost 10-years old Screenweaver project,
I am facing a very exasperating challenge. I have to deploy my ASP.NET MVC

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.