Sie sind nicht angemeldet.

1

Mittwoch, 27. Mai 2009, 00:21

curious "if" - experience

Hallo Klaus,

i ran into the following situation:
A help-box describing basic usage of the app was defined somewhere and is shown up / hidden by user (clicking the help button).
The plugin "HelpBox" and the corresponding actions "showHelp" and "hideHelp" already worked fine.
All easy, all worked...

...until i decided to show this box at startup too. In the main xml-definition there is a plugin "myVar", only carrying certain vars (maincolor of my tour elements, showMapAtStart, ...) i defined a new var >HelpAtStart = "true"< for it.
And the "HelpBox" additionally now recieved an "onloaded=action(askforhelp)".
This shoud work as following:

Quellcode

1
2
3
<action name="askforhelp">
	if(plugin[myvar].HelpAtStart == true, action(showHelp));
</action>

...but does not.
i also tried quoted true:

Quellcode

1
2
3
<action name="askforhelp">
if(plugin[myvar].HelpAtStart == "true", action(showHelp));
</action>

...nothing.
When i test the following, i get results:

Quellcode

1
2
3
4
<action name="askforhelp">
	trace(plugin[myvar].HelpAtStart);     	// ---> traces true
	action(showHelp);                            	// ---> and runs the expected action
</action>

al last i tried this and succeeded(!):

Quellcode

1
2
3
<action name="askforhelp">
	if(plugin[myvar].HelpAtStart, action(showHelp));
</action>


Is this normal to the "if( , ,)" command or a bugy (mis)interpretation of >true< in this case?? *confused*
best regards from www.PanAustria.com

2

Mittwoch, 27. Mai 2009, 08:42

Hi,

no, that's not normal
can you show a full example?

there is a small bug in the current beta 7 with the order of how the actions are executed,
this bug happens only in a combination of if() and action(), maybe this is the problem here...

best regards,
Klaus

Zephyr

Profi

Beiträge: 1 003

Wohnort: Netherlands

Beruf: Web developer

  • Nachricht senden

3

Mittwoch, 27. Mai 2009, 08:44

I had the same issue. I just replaced all the true's and falses to 1,'s and 0's :) Probally true gets handled as a Boolean and the attribute that gets compared as a string. String != Boolean

4

Mittwoch, 27. Mai 2009, 09:10

String != Boolean
ohh, you're right, this was the problem
I have tested and looked at the code again,

normally the predeclared values are from the correct type,
but self declared variables are always strings,

I thought I have already fixed that, but now it's really fixed for beta 8

best regards,
Klaus

5

Mittwoch, 27. Mai 2009, 11:12

but if user declared variables always are interpreted as strings
this (i tried)

Quellcode

1
2
3
<action name="askforhelp">
if(plugin[myvar].HelpAtStart == "true", action(showHelp));
</action>

should work, but also did not...

See all relevant code here:

Quellcode

1
2
3
4
5
6
7
8
9
<plugin name = "myvar" 
	keep="true"
	maincolor="0xFFCC00"
	radarcolor="0xFFCC00"
	radarfillalpha="0.7"
	prevTextbackcolor="0x000000"
	mapStart="closed"
	HelpStart="true"  
/>

and

Quellcode

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<plugin name="Help" 
	url="HelpPane.png"
	zorder="120" 
	shift="0"
	keep="true" 
	align="center"
	edge="center"
	alpha="1"
	visible="false"
	onclick="action(hideHelp);"
	onhover="showtext(Klick zum Schließen, buttonstyle);"
	onloaded="action(askforhelp)";
/>
<action name="askforhelp">
	if(plugin[myvar].HelpStart, action(showHelp));
</action>

<action name ="showHelp">
			plugin[Help].changeorigin(top,center);
			set(plugin[Help].y,-400);
			set(plugin[Help].alpha,1);
			set(plugin[Help].visible,true);
			plugin[Help].changeorigin(center,center);
			action(blackyOn, 0.5,freeze);
			delayedcall(0.3,tween(plugin[Help].y,0,1.5,easeOutQuint));
</action> 
<action name="hideHelp">
			action(blackyOff);
			tween(plugin[Help].alpha,0,0.5,,set(plugin[Help].visible,false)); 
	</action>


ONLY(!) this works; if you (in the acion "askforhelp") compare [myvar].helpstart against any value it does not!
best regards from www.PanAustria.com

6

Mittwoch, 27. Mai 2009, 11:21

Hi,
but if user declared variables always are interpreted as strings
this (i tried)

<action name="askforhelp">
if(plugin[myvar].HelpAtStart == "true", action(showHelp));
</action>

should work, but also did not...
that's because the quotes ("") are currently not resolved (but in beta 8 they are),
in this case it would compare - true - with - "true" - again not the same

dany89vl

Anfänger

Beiträge: 8

Wohnort: Ramnicu Valcea | Sibiu , Romania

Beruf: Panoramas, Web Design, Graphics

  • Nachricht senden

7

Samstag, 26. Juni 2010, 23:27

I have one question. How do i use BlackyOn and BlackyOff ?
I've tried to put blackyon when people click on the info button, but doesn't do anything.

Here is the code:

Quellcode

1
2
3
4
5
6
7
8
9
10
11
12
13
14
<action name="closehelp">
	[b]blackyOn(0.5, true);[/b]
	set(plugin[dragmode].visible, true);
	set(plugin[movemode].visible, false);
	tween(plugin[help].alpha,0,distance(1,0.15),,set(plugin[help].visible,false));
	</action>
	
	<action name="starthelp">
	set(plugin[dragmode].visible, false);
	set(plugin[movemode].visible, true);
	tween(plugin[closebutton].alpha,0.9,distance(1,0.1),,set(plugin[closebutton].visible,true));
	tween(plugin[help].alpha,0.9,distance(1.5,0.1),,set(plugin[help].visible,true));
      [b]  blackyOff();[/b]
	</action>


I am missing something ?