all groups > flash actionscript > august 2005 >
You're in the

flash actionscript

group:

What?s wrong in this if-statement with "or"?


Re: What?s wrong in this if-statement with "or"? David Stiller
8/22/2005 2:34:48 PM
flash actionscript:
highlander_1,

[quoted text, click to view]

Can you explain why not? The bitwise OR operator | returns a 32-bit
integer, but your if() statement is looking for an expression that evaluates
to a Boolean. When it doesn't find a Boolean, I believe it will assume
false every time.


David
stiller (at) quip (dot) net
"Luck is the residue of good design."

Re: What?s wrong in this if-statement with "or"? David Stiller
8/22/2005 3:31:56 PM
[quoted text, click to view]

Elementary. ;) It's all in the ActionScript Language Reference.


David
stiller (at) quip (dot) net
"Luck is the residue of good design."

Re: What?s wrong in this if-statement with "or"? David Stiller
8/22/2005 4:38:29 PM
[quoted text, click to view]

Uhhm. Okay. :)

[quoted text, click to view]

How do you know they aren't being executed? If you see the trace in
your Output panel, but you don't see the gotoAndStop() or _alpha changes, I
could guess that your path to mcKund4 is incorrect. The lines are executing
if you see the trace() statement, but you're sending them to the wrong
place.


David
stiller (at) quip (dot) net
"Luck is the residue of good design."

What?s wrong in this if-statement with "or"? highlander_1
8/22/2005 5:44:54 PM
What?s wrong in this if - statement?

Sometimes - mostly the second time the following statement runs and the trace
action
says this - "check if Kund4Down is true".
But the statement _parent.mcKund4.gotoAndStop("Hit2");
never runs.
I?ve checked the debugger in detail and the variable kund4Down is always true.
(Not the first time, but the second time and so on..)

What could possible be wrong?

Here?s the code:

_parent.mcKund1.onRelease = function(){
if((_parent.kund4Down == true)|(_parent.kund4Rollover == true)){
trace("check if Kund4Down is true");
_parent.mcKund4.gotoAndStop("Hit2");
_parent.mcKund4._alpha = 38;
_parent.kund4Rollover = false;

}

I appreciate if someone could say something

:)
Re: What?s wrong in this if-statement with "or"? bwm_razel
8/22/2005 6:08:40 PM
Re: What?s wrong in this if-statement with "or"? bwm_razel
8/22/2005 6:23:19 PM
By the way, why do you use _parent. if front of everything? If you're already
setting a button's actions using my_btn.onRelease = function(), why don't you
just put that in the main timeline so you don't need to use _parent. everywhere?
Re: What?s wrong in this if-statement with "or"? highlander_1
8/22/2005 6:29:03 PM
Not, it was not the logical operator. For a moment I was lucky that you maybe have identified the problem.
But thanks anyway!!
Re: What?s wrong in this if-statement with "or"? bwm_razel
8/22/2005 6:34:42 PM
Re: What?s wrong in this if-statement with "or"? highlander_1
8/22/2005 6:40:02 PM
Thanks - yes it seems weird to like I do.
But It is simplier to run the debbuger and get a complete and clear overview
and keep the variables in order,
if these variables is showing up in level0 in the debbuger.

:)
Re: What?s wrong in this if-statement with "or"? highlander_1
8/22/2005 6:46:58 PM
[quoted text, click to view]

Interesting - I?ll be back

:)
Re: What?s wrong in this if-statement with "or"? highlander_1
8/22/2005 8:04:26 PM
Ok, I skip the if-statement with "or".

I?m just write another line of code with that if statement.
So let us focus on the following:
_parent.mcKund1.onRelease = function(){
if(_parent.kund4Down == true){
trace("check if Kund4Down is true");
_parent.mcKund4.gotoAndStop("Hit2");
_parent.mcKund4._alpha = 38;
}
};

Why is the line with the trace action been executed, if the rest of lines
not been exexuted?

:confused;

Re: What?s wrong in this if-statement with "or"? bwm_razel
8/22/2005 8:08:09 PM
Re: What?s wrong in this if-statement with "or"? highlander_1
8/22/2005 8:25:45 PM
It?s a boolean variable.
Re: What?s wrong in this if-statement with "or"? highlander_1
8/23/2005 12:00:00 AM
Ok, thanks for your answer!
But I?ve placed some "trace action" at label "Hit2" in mcKund4 - where another
mckund4Hit2 is. (a short closing animation)

The timeline seems always go to that frame (label - Hit2) and sometimes to
frame 7 or frame 8
in "mckund4Hit2" timeline. But "mckund4Hit2" is not playing all the frames -
thats one of the problem.
(I?ve soon placed trace action in every frames in my movie and viewed the
alpha value and so on in the Debugger)
That?s facts. (But maybe I missed something that?s obviously , because I?m
tired of struggling with the same
problem over and over)

Once I shorted the animation in that timeline - "mcKund4Hit2" to max 7 frames.
(It is now 15 frames)
But the problems comes back - it seems to me that Flash "go nuts" if there?s
to much "going on"
I hope my answer is wrong.
:confused;:(
Re: What?s wrong in this if-statement with "or"? highlander_1
8/23/2005 12:00:00 AM
Short question - MX 2004 debbuger - ist it reliable?
Re: What?s wrong in this if-statement with "or"? David Stiller
8/23/2005 12:10:55 PM
highlander_1,

[quoted text, click to view]

Reliable, yes. But it can get to be annoyingly slow, depending on the
complexity of your app.


David
stiller (at) quip (dot) net
"Luck is the residue of good design."

Re: What?s wrong in this if-statement with "or"? highlander_1
8/23/2005 8:32:04 PM
Yes, I know
Re: What?s wrong in this if-statement with "or"? highlander_1
8/24/2005 12:00:00 AM
Now, I have find the problem. It was a component which was placed in each 6
mc:s (buttons).
The name of the components is or was - Sticky and Zoomer.
But now I have come to the next problem:
- How do I keep ( or retain) these effects without any problems.
- I would be happy if there are a some as.class or similar that could "create"
the same effect like
Sticky and Zommer did. ( a sort of bounce effect, and zooming)
Re: What?s wrong in this if-statement with "or"? David Stiller
8/24/2005 11:08:58 AM
[quoted text, click to view]

I'm afraid you simply haven't provided enough information for people
here to help you. I've never heard of components named Sticky and Zoomer,
so I don't know what affects they provide. Even with your code sample, I
cannot see the full context of your project in my mind.

[quoted text, click to view]

Components *are* classes -- or, more specifically, they are classes that
have been packaged up as MXP files to be easily distributed. When written
well, components often provide features configurable via user-friendly UI,
so who knows ... maybe an AS file version of what you're after would be
harder?

In any event, it sounds like you would benefit from an all-around,
general study of ActionScript before you tinker too much further with
components and classes. The difference between logical OR and bitwise OR is
a case in point. I sat this to encourage you, not discourage you. :)


David
stiller (at) quip (dot) net
"Luck is the residue of good design."

Re: What?s wrong in this if-statement with "or"? highlander_1
8/24/2005 9:19:26 PM
Would you like to see my 3d gallery .fla-file?
- without saying "Oh my God!" - twice!
Re: What?s wrong in this if-statement with "or"? David Stiller
8/25/2005 8:18:39 AM
highlander_1,

[quoted text, click to view]

Sure. If I misjudged your skills, I'll be happy to put my foot in my
mouth. I really mean that. :)


David
stiller (at) quip (dot) net
"Luck is the residue of good design."

Re: What?s wrong in this if-statement with "or"? highlander_1
8/26/2005 8:35:09 AM
here:
Re: What?s wrong in this if-statement with "or"? highlander_1
8/26/2005 8:45:52 AM
Click on "Gallery"
As you can see, only 2 buttons out of 6 is working - these are under
"production"
Bugs:
1 Slideshow - The content doesn?t play (loadMovie.swf) automaticly
2. Buttons - Does not close, somethimes, before rotating the menu
3. One button is left visible, sometimes, before rotating the menu


:)
Re: What?s wrong in this if-statement with "or"? David Stiller
8/26/2005 8:58:13 AM
highlander_1,

[quoted text, click to view]

The link you showed is nice work. :) Kudos on the design and
programming in progress. Now, if you're able to program such geometric
patterns, how is it you had trouble with the difference between || and | ?
I'm not mocking you, I promise; I'm just curious.


David
stiller (at) quip (dot) net
"Luck is the residue of good design."

Re: What?s wrong in this if-statement with "or"? highlander_1
8/27/2005 12:00:00 AM
[quoted text, click to view]


Because I?m reading and learning all the time, listen and learn from other
peoples problem,
and learning from the great programmers here on this forum. (and of my own
misstakes)
I don?t focus on details as "difference between || and | ?", only if there is
a faster way of solving the problem.
But you can learn me a lot - like the "difference between || and | ?" .That?s
another thing, and you are
good at what you?re doing.
My own homesite was and is still a living nightmare and I?m not good at
programming geometric shapes
and 3d rotating. But here is one person who?s really good at that, and I have
learned a lot from his homesite.
http://www.bit-101.com.

Here in Sweden its raining, the temparture is 10 degree and I think I might
see a horror movie to night
so I forget the horrible "Bugs" on my homesite.

;)
Re: What?s wrong in this if-statement with "or"? David Stiller
8/29/2005 9:39:50 AM
highlander_1,

[quoted text, click to view]

There are plenty here. It's good that you continually desire to learn.

[quoted text, click to view]

It may sound like a contradiction, but I believe the more time you spend
focusing on details, the faster you'll solve *all* your problems.

[quoted text, click to view]

Yes, Keith Peters is quite an inspiration.

[quoted text, click to view]

Ha! Enjoy.


David
stiller (at) quip (dot) net
"Luck is the residue of good design."

Re: What?s wrong in this if-statement with "or"? highlander_1
8/29/2005 8:00:58 PM
[quoted text, click to view]

Ok!
- with all my respect to your opinion.

Re: What?s wrong in this if-statement with "or"? highlander_1
8/31/2005 8:09:58 AM
<here:
<http://www.goodwill.se/peter

I can see there are lots of visitors and thats nice, but it would be even
nicer if someone has some suggestion
of how to solvin the bugs.
Just ask for the .fla-file.
:)
AddThis Social Bookmark Button