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 6776361
In Process

The Archive Base Latest Questions

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

I have below piece of code in my actionscript file (defined in a function)

  • 0

I have below piece of code in my actionscript file (defined in a function)

var cmbSyncItems:Object = new Object();
cmbSyncItems = {tooltip:xmlContent.messages.cmbsync[0].tooltip, option1label:xmlContent.messages.cmbsync[0].option1[0].label, option1data:xmlContent.messages.cmbsync[0].option1[0].data, option2label:xmlContent.messages.cmbsync[0].option2[0].label, option2data:xmlContent.messages.cmbsync[0].option2[0].data};
cmbSync = new ObjectProxy(cmbSyncItems);

var btnFeedbackItems:Object = new Object();
btnFeedbackItems = {tooltip:xmlContent.messages.btnfeedback[0].tooltip, label:xmlContent.messages.btnfeedback[0].label};
btnFeedback = new ObjectProxy(btnFeedbackItems);

Below is the rewritten code utilizing the same ‘items’ object over and over again.

var items:Object = new Object();
items = {tooltip:xmlContent.messages.cmbsync[0].tooltip, option1label:xmlContent.messages.cmbsync[0].option1[0].label, option1data:xmlContent.messages.cmbsync[0].option1[0].data, option2label:xmlContent.messages.cmbsync[0].option2[0].label, option2data:xmlContent.messages.cmbsync[0].option2[0].data};
cmbSync = new ObjectProxy(items);

items = new Object();
items = {tooltip:xmlContent.messages.btnfeedback[0].tooltip, label:xmlContent.messages.btnfeedback[0].label};
btnFeedback = new ObjectProxy(items);

The items Object will be repeated many times (more than hundreds) in the same file.

Which method of coding is better (First block or second block) ?

Will it be okay if i take on the ‘second’. Does using the first approach makes any difference (in terms of memory consumption)?

  • 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-26T16:01:10+00:00Added an answer on May 26, 2026 at 4:01 pm

    i’d rather suggest a third option:

    cmbSync = new ObjectProxy( { tooltip:xmlContent.messages.cmbsync[0].tooltip, 
                                 option1label:xmlContent.messages.cmbsync[0].option1[0].label, 
                                 option1data:xmlContent.messages.cmbsync[0].option1[0].data, 
                                 option2label:xmlContent.messages.cmbsync[0].option2[0].label, 
                                 option2data:xmlContent.messages.cmbsync[0].option2[0].data } );
    btnFeedback = new ObjectProxy( { tooltip:xmlContent.messages.btnfeedback[0].tooltip, 
                                     label:xmlContent.messages.btnfeedback[0].label } );
    

    upd
    the first approach doesn’t seem to be much more memory hungry if all that objects are declared as local variables, but all that declarations are imho really needless

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

Sidebar

Related Questions

Below i have pasted my piece of javascript code here 1) function showCustomerName(dropdown) {
I have below piece code which runs on JDK5 private static ThreadLocal<String> messages =
I have this piece of code here below: $fq.= + (fritidsboende_uth_from:[$fritids_uth_from TO *] AND
I have a piece of code shown below #include <stdio.h> #include <stdlib.h> void Advance_String(char
I have a piece of code something like below. I'm using Microsoft Visual C#
I have the below piece of code which Prefixs a string to the start
I have a small piece of code in a template file that I ONLY
I have below piece of code in one my JSP <%@ page language=java import
I have a code piece that looks something like what I've pasted below: import
I have a piece of code, copied below, with really similar structs in which

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.