Alpha property calculation problem

Hi all

I have a strange problem in the calculation of the alpha values because the results of the calculations differ from the results obtained by the same calculations with a normal variable of type 'Number'.

I calculated this way (increment the alpha property and another variable Numer of 0.01 from 0):

var delta: Number = 0.01;

var myNumber:Number = 0;

myLoader.alpha = 0;

While (myLoader.alpha < 1) {}

myNumber += delta;

myLoader.alpha += delta;

trace (myLoader.alpha + "" + myNumber);

}

Below is the list of values:

0          0

0.01 0,0078125

0,015625 0.02

0.03 0,0234375

0,03125 0.04

0,0390625 0.05

0.060000000000000005 0,046875

0.07 0,0546875

0,0625 0.08

0,0703125 0.09

0.09999999999999999 0,078125

0.10999999999999999 0,0859375

0.11999999999999998 0,09375

0.12999999999999998 0,1015625

0.13999999999999999 0,109375

0,1171875 0.15

0.16 0.125

0.17 0,1328125

... cut...

1.1200000000000008 0.875

1.1300000000000008 0.8828125

1.1400000000000008 0.890625

1.1500000000000008 0.8984375

1.1600000000000008 0.90625

1.1700000000000008 0.9140625

1.1800000000000008 0.921875

1.1900000000000008 0.9296875

0,9375 1.2000000000000008

1.2100000000000009 0.9453125

1.2200000000000009 0.953125

1.2300000000000009 0.9609375

1.2400000000000009 0.96875

1.2500000000000009 0.9765625

1.260000000000001 0.984375

1.270000000000001 0.9921875

1 1.280000000000001

To get less incorrect values that I have to the workaround in this way:

While (myLoader.alpha < 1) {}

myNumber += delta;

myLoader.alpha += myNumber;

}

Anyway, there is still an error, as indicated by the present:

Delta = 0.01;

myLoader.alpha = delta;

trace (myLoader.alpha + "" + delta);

gives:
0.01 0,0078125
Can you help me to explay the weird behavior and solve?
Thanks in advance.
Antonio

It's a binary decimal conversion.  internally, flash uses a binary number for the alpha property.

Tags: Adobe Animate

Similar Questions

  • The alpha property does not not on TextField if publication of Reader 9

    Hello

    I have a movie that works very well when I publish to Reader 10, but when I publish to Reader 9, the code that assigns an alpha property to my TextFields stops working. I have a previous movie, I probably did in CS4, which uses code similar to fade in and out TextFields. It was published for Reader 9 and works very well. Is it possible that something has changed in CS5 (note that I don't use of TLF, only the dynamic TextFields text boxes)?

    Here is an example of the code that I use:

    Stop();
    Import fl.transitions.Tween;
    Import fl.transitions.TweenEvent;
    Fl.transitions.easing import. *;
    import flash.events. *;
    import flash.text. *;
    import flash.text.TextFormat;
    import flash.utils.Timer;
    import flash.display.MovieClip;
    import flash.display.Sprite;

    var txtFormat1:TextFormat = new TextFormat();
    txtFormat1.font = "Optima"
    txtFormat1.color = 0 x 000000;
    txtFormat1.bold = false;
    txtFormat1.size = 16;
    txtFormat1.leading = 2;

    var subtitle: TextField = new TextField();
    subtitle.autoSize = TextFieldAutoSize.CENTER;
    Subtitle.Selectable = false;
    subtitle.defaultTextFormat = txtFormat1;

    var fadeInSubtitle:Tween;

    addChild (subtitle);
    Subtitle.x = stage.stageWidth / 2 - subtitle.width / 2;
    Subtitle.y = stage.stageHeight / 2 - subtitle.height / 2;
    Subtitle.Alpha = 0;
    Subtitle.Text = "what is the most important question in";

    fadeInSubtitle = new Tween(subtitle,"alpha",None.easeNone,0,1,3,true);

    You must embed fonts.

  • Flex Builder Alpha 2 installation problem

    Hi all

    I have the Flex Builder Alpha 2 installation problem on my Fedora 8 64-bit. Basically, as soon as I click on the license agreement, the installer says "Please wait, Adobe_Flex_Builder_Linux is configured for your system. This may take a moment... "and then no progress at all. There is no error on the console. Someone knows how to fix this?

    Finally I discovered that I could not install the Flex Builder because my system is running IcedTea 1.7 x86_64. Once I turn it on to another Java (1.5.0 - gcj), the Setup program works like charm. I guess that's because the installation program stops somehow when running on IcedTea.

  • Alpha property to dynamic text does not

    Hello

    I generated dynamically through multiple TextFields a loop for. I wish that all the text fields to have their value alpha equal to 0 so that each field can finally fade.

    When I apply the alpha property to 0, or same.5 the text always seems to be an alpha of 1. Does anyone know how to do to make the text appear with a low to 0 alpha?

    I have included the code for the function that executes the loop for to generate text fields. Please note that the value of the fields are stored in a global array, and text objects are also global, and are declared in the main body of the class.

    Thank you in advance for any help you are able to provide, the code is attached below

    Lee

    But in reality you are integrating the police, affecting not only IncorporerPolices to true? You know, library, a new font... link...

  • Video Sony alpha a58 [HELP] problems

    Hey guys.
    For starters, what is the best video format to save the highest definition on the a58 alpha. I can see it is AVCHD which has:

    24 m (fx) 50i

    50i 17 m (fh)

    25 p 25 m (fx)

    25 p 17 m (FH)

    And then there are MP4 1440 x 1080 12 m then vga.
    Now I don't know anything about these settings, but when I look on my pc the quality sucks.

    My question is, what is the best video setting of the foregoing for the very high deffinitions.

    My second question is, when I have import in first pro cs6 what import settings I make use and only export the settings should I use?

    Please get back to me!

    As we talked about in our previous thread, AVCHD 50i 24 M (FX) would be the setting that will give you the best video quality. Playback problems you encounter can be attributed to the computer and the software that you are using.

    You can refer to the Adobe Premiere Pro support page for more information on the best settings to use in the import of videos taken by the camera.

    If this post answered your question, please mark "accept as a Solution.

  • Calculator problem

    Hello

    I have windows 8 and you have a problem with the built-in Windows calculator.
    If I use the scientific view, the button does not work, but it works in standard mode.
    Is this a known issue?
    Is there a way I can fix it?
    Any help appreciated.
    Sorry didn't know which topic to choose.

    Hi Nick,

    The System File Checker tool analyzes the system files and replaces incorrect versions of system files by using the correct versions. To run the System File Checker, you'll need open an elevated command prompt. This can be done:

    • Enter the start screen
    • Press Windows + C keys on your keyboard to show the charms. (If you use a touch screen: touch the right edge of the screen and slide your finger to the center of the screen to display the bar of charms)
    • Click on search
    • Type the command prompt in the search field
    • Click with the right button on command prompt (if you use a touch screen: touch and hold your finger at the command prompt, drag your finger downwards until you see an outline around the tile and finally release your finger on the screen.)
    • Click on run as administrator

    Enter the command: sfc/scannow
    Note: If you use a touch screen you can open the touch keyboard for the command prompt by typing on the keyboard icon in your taskbar near the system tray.

    Thank you.

  • Calculation problem

    Hello

    I'm having a problem with the following calculation:

    ?? + ?? + ?? + ?? + ?? + ?? - ?? =??

    Is this possible with the option calculate or do I need a javascript, if she needs a javascript script is - anyone know the script required.

    Thanks in advance

    Paul

    It can be done with the notation of simple fields option.

  • Access of undefined property _btn (problems with the buttons)

    I get this error message:

    Scene 1, Layer 'actionscript', frame 1, line 11120: access of undefined property tennis1_btn.
    Scene 1, Layer 'actionscript', frame 1, line 71120: access of undefined property tennis2_btn.
    Scene 1, Layer 'actionscript', frame 1, line 131120: access of undefined property tennis3_btn.
    Scene 1, Layer 'actionscript', frame 1, line 191120: access of undefined property tennis4_btn.
    Scene 1, Layer 'actionscript', frame 1, line 251120: access of undefined property tennis5_btn.
    Scene 1, Layer 'actionscript', frame 1, line 311120: access of undefined property tennis6_btn.

    Here is a screenshot of my code

    flashscripterror.jpg

    I'll also paste below:

    tennis1_btn.addEventListener (MouseEvent.CLICK, gotennis1);

    function gotennis1(event:MouseEvent):void {}

    var gotennis1url:URLRequest = new URLRequest ("juniortennis.php");

    navigateToURL (gotennis1url, "_parent");

    }

    tennis2_btn.addEventListener (MouseEvent.CLICK, gotennis2);

    function gotennis2(event:MouseEvent):void {}

    var gotennis2url:URLRequest = new URLRequest ("adulttennis.php");

    navigateToURL (gotennis2url, "_parent");

    }

    tennis3_btn.addEventListener (MouseEvent.CLICK, gotennis3);

    function gotennis3(event:MouseEvent):void {}

    var gotennis3url:URLRequest = new URLRequest ("http://abbottsports.com/membership/memberships.php#tennis" ");

    navigateToURL (gotennis3url, "_parent");

    }

    tennis4_btn.addEventListener (MouseEvent.CLICK, gotennis4);

    function gotennis4(event:MouseEvent):void {}

    var gotennis4url:URLRequest = new URLRequest ("staff.php");

    navigateToURL (gotennis4url, "_parent");

    }

    tennis5_btn.addEventListener (MouseEvent.CLICK, gotennis5);

    function gotennis5(event:MouseEvent):void {}

    var gotennis5url:URLRequest = new URLRequest ('calendar.php');

    navigateToURL (gotennis5url, "_parent");

    }

    tennis6_btn.addEventListener (MouseEvent.CLICK, gotennis6);

    function gotennis6(event:MouseEvent):void {}

    var gotennis6url:URLRequest = new URLRequest ("tenniscourts.php");

    navigateToURL (gotennis6url, "_parent");

    }

    Please help: I have a couple of them types of menus, but it's the only one that gives me problems.  Here is the site that I use on:

    www.abbottsports.com of work

    http://abbottsports.com/football/football.php Working

    http://abbottsports.com/Motocross/Motocross.php working

    I add another on our page of tennis. I just copied the flash files on my tennis records and renamed all tennis instead of football, including buttons, as you can see on the right side of the page in the photo.

    I'm sure it has something to do with me rename the button, because I never changed anything in the code except substitute the word tennis football in each place. and renamed my buttons to tennis instead of football.

    Thanks for any help.

    Instance names your buttons are 'football1_btn '... 'football6_btn '.

    Rename them to "tennis1_btn"... "tennis6_btn" and you're golden.

  • The XY graph Plot.LineWidth Property node problem

    Hello!

    I have a loop, where I repeatedly putting curves in a XY Chart. In the first iteration of the loop, after the first corner appears on the graph (I send data from the graphical indicator), I use a Plot.LineWidth Property node to align the thicker. However, in the next iteration, when the second plotted curve appears on the graph, and the property node is pulled again, the second curve remains thin. I guess what I've done wrong, that this property node defines only the first curve? How can I set the width of the line of all the curves of the XY graph on the same value? When I directly on the properties of XY graph, I can set the width of the curve, but only one by one...

    Suggestions how set the widths of the ground on a specific chart XY?

    Thank you!

    If it is a multiplot XY, you must set each plots properties by using the property activeplot (index of the new lot), then by setting the thickness.

  • Alpha C dev problem - alpha device blackberry 10 dev program is over...

    I got this message after I upgraded to the latest firmware and now it won't go away, even after a reboot. Also tried to re - load the firmware, but no luck.

    Help, please.

    Update on this problem:

    My problem has been resolved, but it took a replacement of the device to solve.

    I'll be shipping the defective unit to BB, so I hope they can figure out what went wrong and prevent other developers.

  • Query for the age calculation problem

    Hello

    I am trying to calculate the age using MONTHS_BETWEEN, then divide by 12

    CREATE TABLE DOB (date of DATE_OF_BIRTH);

    Insert into values of birth date (DATE_OF_BIRTH) (to_date('13-JAN-54','DD-MON-RR'));

    Insert into values of birth date (DATE_OF_BIRTH) (to_date('26-APR-54','DD-MON-RR'));

    Insert into values of birth date (DATE_OF_BIRTH) (to_date('30-JUN-29','DD-MON-RR'));

    Insert into values of birth date (DATE_OF_BIRTH) (to_date('03-JAN-67','DD-MON-RR'));

    Insert into values of birth date (DATE_OF_BIRTH) (to_date('04-AUG-49','DD-MON-RR'));

    Insert into values of birth date (DATE_OF_BIRTH) (to_date('27-DEC-47','DD-MON-RR'));

    Insert into values of birth date (DATE_OF_BIRTH) (to_date('21-MAR-67','DD-MON-RR'));

    Insert into values of birth date (DATE_OF_BIRTH) (to_date('26-SEP-56','DD-MON-RR'));

    Insert into values of birth date (DATE_OF_BIRTH) (to_date('06-MAY-52','DD-MON-RR'));

    Insert into values of birth date (DATE_OF_BIRTH) (to_date('01-JAN-00','DD-MON-RR'));

    Insert into values of birth date (DATE_OF_BIRTH) (to_date('07-JUL-63','DD-MON-RR'));

    Insert into values of birth date (DATE_OF_BIRTH) (to_date('24-JAN-62','DD-MON-RR'));

    Insert into values of birth date (DATE_OF_BIRTH) (to_date('22-OCT-63','DD-MON-RR'));

    Insert into values of birth date (DATE_OF_BIRTH) (to_date('15-OCT-36','DD-MON-RR'));

    Insert into values of birth date (DATE_OF_BIRTH) (to_date('06-SEP-36','DD-MON-RR'));

    Insert into values of birth date (DATE_OF_BIRTH) (to_date('27-FEB-60','DD-MON-RR'));

    Insert into values of birth date (DATE_OF_BIRTH) (to_date('03-NOV-75','DD-MON-RR'));

    Insert into values of birth date (DATE_OF_BIRTH) (to_date('08-APR-52','DD-MON-RR'));

    Insert into values of birth date (DATE_OF_BIRTH) (to_date('21-APR-60','DD-MON-RR'));

    Insert into values of birth date (DATE_OF_BIRTH) (to_date('22-MAR-57','DD-MON-RR'));

    Insert into values of birth date (DATE_OF_BIRTH) (to_date('21-SEP-63','DD-MON-RR'));

    Insert into values of birth date (DATE_OF_BIRTH) (to_date('27-JAN-73','DD-MON-RR'));

    Insert into values of birth date (DATE_OF_BIRTH) (to_date('29-SEP-65','DD-MON-RR'));

    Select trunc (MONTHS_BETWEEN (SYSDATE, DOB. (DATE_OF_BIRTH) / 12) AS the "âge" of DOB.

    Output

    Age

    ---

    59

    59

    -15

    46

    -35

    -34

    46

    56

    61

    13

    50

    51

    49

    -23

    -22

    53

    37

    61

    53

    56

    49

    40

    47

    I get some as negative age and others as positive tried using "MON-DD-YY" but same result.

    any suggestion

    Thanks for your help.

    Hello

    The formula you use is a good way to get the age in years.
    The problem is that some of your "date of birth" are in the future.  For example:

    Insert into values of birth date (DATE_OF_BIRTH) (to_date('30-JUN-29','DD-MON-RR'));

    We hear June 30, 2029, a little less than 16 years into the future.  When you truncate this number, you get-15...

    In RR version, the actual year is between 2000 and 2049, years-00 to 49 years old are considered as in the current century, but 2000 to 2049.

    This is an example of why you should always use figures 4 years and "YYYY" format, like this:

    Insert into (DATE_OF_BIRTH) date of birth values (to_date (June 30, 1929 ', "DD-MON-YYYY"));

  • Try to set the alpha property, receive the error #1010

    Hello

    I loaded the external content by using this code in the movie clip symbol:

    var thumbLoader16:Loader = new Loader();
    thumbLoader16.contentLoaderInfo.addEventListener (Event.COMPLETE, thumbLoader16CompleteHandl er);

    function thumbLoader16CompleteHandler(e:Event):void {}
    trace ("Thumb16 loaded.'");
    addChild (thumbLoader16);
    }

    thumbLoader16.load (new URLRequest('Thumbnails/Thumb16.jpg'));

    Then, I created an instance of the symbol on the timeline, called ThumbDisplay16.

    I want to darken the ThumbDisplay16 until some content to other charges.

    I can correctly set the alpha to help:

    ThumbDisplay16.alpha =. 5;

    in the main timeline, but I can't find a way to put 1 using the charger of other content.

    The other content uses this code to load into a movie clip symbol:

    var imgLoader16:Loader = new Loader();
    imgLoader16.contentLoaderInfo.addEventListener (Event.COMPLETE, loaderCompleteHandler16);

    function loaderCompleteHandler16(e:Event):void {}
    trace ("Image16 loaded.'");
    addChild (imgLoader16);
    it. ThumbDisplay16.alpha = 1;
    }

    imgLoader16.load (new URLRequest('Full/Full16.jpg'));

    Then, I create an instance of the symbol on the timeline, called PhotoDisplay16 th.

    However, the code:

    This. ThumbDisplay16.alpha = 1;

    does not affect the transparency of the ThumbDisplay16 and I get an error of output when it runs:

    TypeError: Error #1010: a term is undefined and has no properties.
    at Player15_fla::Photo16_44/loaderCompleteHandler16()

    Any thoughts on what I am doing wrong?

    If both clips are the same timeline, so the code that is in one of them must target to the timeline relative to draw attention to the subject of inches...

    function loaderCompleteHandler16(e:Event):void {}
    trace ("Image16 loaded.'");
    addChild (imgLoader16);
    MovieClip (this.parent). ThumbDisplay16.alpha = 1;
    }

  • Sprites/containers - Alpha property

    I created a container for the placement of a number of objects and want to set the alpha to 50% worldwide.

    Why can't just:

    Container.Alpha = 50;

    (container is a sprite)

    Any idea would be appreciated

    Thanks, it worked!

  • Simple calculation problem

    minutes = hours_txt.text * 60 + minutes_txt.text;

    If I enter text in hours_txt of 5 and 10 minutes_txt, why that is the result of the calculation is 30010 no 310?

    Flash is concatenate a string, because one of the operands is a string, and + is a valid string operator.

    If you want a number try this:

    minutes = hours_txt.text * 60 + Number (minutes_txt.text).

    or

    minutes = Number (hours_txt.text) * 60 + Number (minutes_txt.text).

  • Tween alpha in the scenario main no interpolation

    Hey guys

    I'm trying to do something relatively simple... in theory.

    I have a clip on the main timeline I want to tween alpha from 100% to 0% on 8 frames. Now, if I use the Tween AS class, it does exactly that, no problem with that.

    However, if I try to do the interpolation using the timeline, is any tween, it does not even recognize the alpha property to the keyframe, it just stays at 100%.

    I don't want to use AS interpolation because it is running on a specific material which does not lend itself what although that runs using a timer.

    What could be the problem here?

    See you soon

    I found the problem - the clip is positioned by the user entering positions X and Y in an XML file, and when the position has been set it seems to collide with the interpolation of chronology - by removing the location code is interpolation of work very well.

    I end up using the interpolation of ACEs, it's just that we use very, very specialized equipment and there is no precedent for LIKE used interpolation, we try to lighten the load on the processor as possible. Fortunately, it works without any problem.

Maybe you are looking for