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

  • SEARCH
  • Home
  • 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 6804311
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T19:27:01+00:00 2026-05-26T19:27:01+00:00

Something that is very handy in flex is that you can create a component,

  • 0

Something that is very handy in flex is that you can create a component, code it, skin it and then you can reuse it as you like. This means that the code is independent from each one of the copies that you produce.

I am trying to achieve this using html and js (I’m using jQuery, but open to possibilities).

Basically, I created a page (the component) that has it’s own JS code and it’s own skin. Now, I want to replicate this component and have each one with it’s own code.

I tried two options.

  1. Have the components be loaded as an iFrame. This way, it loads two pages, therefore isolating the code within them. However, iFrames are a hassle. They dont work very well with drags and drops and behave differently when it comes to sizing.
  2. I have tried to include these components using PHP. However, when I do this, I can’t figure out how to isolate the code because they all share the same source! In other words, the visual part is split (there are two copies), but the code underneath is the same.

Do you know of any smart way of doing this?

If you need a concrete example, here goes a simple one:

You are creating a car game. There are only two cars. Each player plays in the same keyboard with different keys. Therefore you create a “car” component”. Each car has the same behavior but MUST run independently.

It’s quite easy to build one. But how would you do the second one without duplicating the code?

  • 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-26T19:27:02+00:00Added an answer on May 26, 2026 at 7:27 pm

    I might be misunderstanding a whole lot but are you talking about OOP like so:

    function Car(){}
    
    Car.prototype = {
    
        constructor: Car,
    
        crash: function(){}
    
    };
    
    var firstCar = new Car(),
        secondCar = new Car();
    
    firstCar.crash(); //only first car crashes
    

    I don’t see why here separate sandboxes are required? But nobody is answering so meh.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is something that I think would be very useful. Basically, I'd like there
I need a c# number something that can handle very large numbers but also
I'm trying to wtire unit tests for a function that looks something like this:
Very handy Ruby code: some_map.each do |key,value| # do something with key or value
I'm wrestling with something that should be very simple - specify a sidebar at
I'm pulling my hair out with something that should be very simple: getting line
Suppose I have written a decorator that does something very generic. For example, it
I feel that it should be something very simple and obvious but just stuck
I have a particular application that needs to calculate something very specific, and while
i'm missing something fundamental here. i have a very simple custom class that draws

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.