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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T19:13:39+00:00 2026-05-31T19:13:39+00:00

In our code I have the following, for now please ignore the //* bits;

  • 0

In our code I have the following, for now please ignore the //* bits;

if (data["someKey"] != null)//*
{
    CONSOLE_OUT.info("Print some stuff.");
    TARGET::myTarget
    {
        var someString:String = data["someKey"] as String;//*
        someController.setSoemthing(someString.indexOf("soemthing") > -1 ? true : false);//*
    }
}

I have set up my FlashCS4 to have the TARGET::myTarget compiler constant set to false, meaning that the code within the compiler constant shouldn’t be compiled. At the point of execution data["someKey"] evaluates to null meaning the if statement should NOT execute.

When I debug the following code, the lines with //* on them execute, which is strange behaviour. It skips the initial line after the if statement and goes straight to executing the code that shouldn’t have been compiled, bearing in mind that it shouldn’t enter the if statement anyway. Its almost as if the presence of the compiler constant is causing the if statement to appear to be a single line, and then still executing the code within the wrong scope.

However, if I add an else statement on the end, the code executes fine;

if (data["someKey"] != null)//*
{
    CONSOLE_OUT.info("Print some stuff.");
    TARGET::myTarget
    {
        var someString:String = data["someKey"] as String;
        someController.setSoemthing(someString.indexOf("soemthing") > -1 ? true : false);
    }
}
else
{
    CONSOLE_OUT.info("Print some other stuff.");
}

It should also be noted that in the instance where data["someKey"] evaluates to something other than null, the above version will correctly skip (or not compile) the code within the constant.

I just want to find out if this is a bug, or if I am not using the correct syntax for the compiler constant. If you need any more information then please let me know. I’ve double check my compiler constants, I am using Flash CS4 to compile and targeting Flash Player 10 if that makes a difference.

  • 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-31T19:13:40+00:00Added an answer on May 31, 2026 at 7:13 pm

    Its not bug, compiler will strip any if(false) statement so your conditional constant must be wrapped in condition evaluation.

    if (data["someKey"] != null)//*
    {
        CONSOLE_OUT.info("Print some stuff.");
        if(TARGET::myTarget) // it should be conditional statement
        {
            var someString:String = data["someKey"] as String;//*
            someController.setSoemthing(someString.indexOf("soemthing") > -1 ? true : false);//*
        }
    }
    

    If you look at flex sample, they have applied symbol outside method declaration, so when you write conditional compilation symbol outside member body, member body is included/excluded, but in case of inline statement, flex has no way to determine what to exclude, so it should be used in condition within if.

    See answers and links here,

    Flash/Flex conditional compilation "else"

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

Sidebar

Related Questions

I have the following code in one of our projects webpages: XmlDocument xDoc =
We have similar code to the following in one of our projects. Can anyone
I have the following code to check for form data and I can't figure
In our code we have quite a few cases of this pattern: class outerClass
In many places in our code we have collections of objects, from which we
We’ve found that the unit tests we’ve written for our C#/C++ code have really
In our code we used to have something like this: *(controller->bigstruct) = ( struct
We have recently started using FxCop on our code base and I am in
I have introduced boost to our code base, on my machine I created a
We have this anonymous function in our code, which is part of the jQuery's

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.