I've seen this can of error many times over the years I've been coding
and teaching programming and warn my students to be careful of int/int
calculations due to the truncation of the answer back to an int. You'd
think this sort of thing would get flagged by the compiler but
nope....

Yvan.

On Jan 29, 9:12 pm, Fabrice3D <[email protected]> wrote:
> > Since this results in (probably) an int, rather than a Number,
>
> Yes that's probably the case. Indeed something to take in account for future 
> updates.
>
> Fabrice
>
> On Jan 29, 2010, at 9:47 PM, delfeld wrote:
>
> > Since this results in (probably) an int, rather than a Number, it
> > might be a good idea to go throughout the Away3D code and force the
> > numbers to be Numbers.
>
> > I am not sure if it is because the numerator is an int, or the
> > denominator, or what; but Away3D has a hundred or so instances where
> > it is initializing a Number with an int, and a few places where there
> > is a similar "int/int" initialization.
>
> > BTW, I have experienced this problem in a very large project, and it
> > took two days to track down that the Number was not initializing
> > correctly.  This was not using the Flex method of programming, but
> > using Flash directly with an external class structure.  So I think the
> > problem is more pervasive than just in Flex.
>
> > Looking at AS3 c++ code, Numbers are checked for whether they are
> > initialized as "int" before they are checked for if they are "double",
> > since initializing as int is much more common.  I could not track down
> > the actual way this works and test it - not enough hours in the day -
> > but it may be worth the time to find the actual error.
>
> > On Jan 29, 5:50 am, Greg209 <[email protected]> wrote:
> >> I came across an issue when using Cube with a map6 material, compiled
> >> through the Flex 3.2 sdk (other versions/circumstances may have the
> >> same issue) which was reported on the group in this thread :-
>
> >>http://groups.google.com/group/away3d-dev/browse_thread/thread/e3e48b...
>
> >> Basically, the problem is that the UV is all messed up when using map6
> >> material mapping. Tracking it through, it seems to be a strange bug in
> >> flex.
>
> >> Simply changing the declaration of .....
>
> >>  private var _offset:Number = 1/3;
>
> >> to
>
> >>  private var _offset:Number = 1/3.0;
>
> >> .... seems to make the calculation work. Previously it was coming out
> >> as zero, hence
> >> the UVs were all messed up.
>
> >> I've updated the trunk for both fp9 and fp10 versions of Cube.as.
> >> Hopefully things should work now.
>
> >> Greg

Reply via email to