Skip to first unread message

Projeto AppInventor

unread,
Aug 15, 2015, 6:16:18 PM8/15/15
to MIT App Inventor Forum
I am with a really serious help and want to know if you can help me.

As App Inventor has some 'Capacity Issues' I cannot create lots of Screens in my project. So, one of my screens is a 'Dynamic One', which receives a StartValue from another one and acts according to this value.

This 'Dynamic Screen' has one Canvas and Two ImageSprites, depending on which value this Screen receives, a different background image is used in the Canvas component and I have to move the two image Sprites to different positions in the Canvas (depending on which background is used) because these two ImageSprites are buttons in specific parts of the image and will open an ActivityStarter that runs the youtube application in a given URL. The ImageSprites positions, the canvas background and video that will played when the canvas is pressed will depend of course on the input.

My problem here is that I cannot move these sprites this way (dynamicaly depending on StartValue the Screen receives), it simply doesn't work (I think it is a bug). I tried everything, setting ImageSprite.x, ImageSprite.y, use functions ImageSprite.Moveto, ImageSprite.PointTowards, it simply doesn't work if the Screen receives an StartValue.

If I am on 'Blocks' tab and click with right button on the function ImageSprite.MoveTo and select 'Do It', the ImageSprites can be moved. Also, if I access the 'Design' tab and inform which Background will be used in Canvas, the ImageSprites are also moved without problems (I don't want this scenario, I want the background changing depending on StartValue).

Below is my 'Blocks' Tab, what is wrong here? it is a bug? can you please help me with this issue? how can I move the ImageSprites on a Canvas depending on which StartValue a screen receives? 



AppInventor_Blocks.png

Taifun

unread,
Aug 15, 2015, 6:55:00 PM8/15/15
to MIT App Inventor Forum
did you start with Screen1 and then open screen historia using the open another screen with start value block?
use Do it to debug your start value in screen historia, see also tip 4 here 

As App Inventor has some 'Capacity Issues' I cannot create lots of Screens in my project
you do not need lots of screens, see here why: Building apps with many screens

Taifun

Projeto AppInventor

unread,
Aug 15, 2015, 7:06:40 PM8/15/15
to MIT App Inventor Forum
'did you start with Screen1 and then open screen historia using the open another screen with start value block?'

Yes, I did it.

'use Do it to debug your start value in screen historia, see also tip 4 here'

Yes, debugging it shows me the right value passed (value 1)

Thank you for the suggestions. 


Taifun

unread,
Aug 15, 2015, 7:14:21 PM8/15/15
to MIT App Inventor Forum
also use Do it in the = block to find out, if the result of "if get start value = 1" is true or false
make sure to pass 1 and not 1 followed by a space...
Taifun

Projeto AppInventor

unread,
Aug 15, 2015, 7:27:42 PM8/15/15
to MIT App Inventor Forum
The Do it result is true, and everything works fine except the ImageSprites MoveTo function. For example, as can be seen in the attached figure of my Blocks tab, the Canvas background changes and the ImageSprite dimensions change. I checked that the value passed is 1 as can be seen in the image below.



Thank you again. 

Taifun

unread,
Aug 15, 2015, 8:58:09 PM8/15/15
to MIT App Inventor Forum
you first move the sprites and then set the x and y directly...


what about removing the procedure and setting the sprites to the position you want directly?
Taifun

Min Zarni Aung

unread,
Aug 15, 2015, 9:42:30 PM8/15/15
to MIT App Inventor Forum
I guess you are testing live.
Build APK file and install to test.
Live testing has some bugs like that.

Taifun

unread,
Aug 16, 2015, 10:33:42 AM8/16/15
to MIT App Inventor Forum
Live testing has some bugs like that
???
can you say more?

if you first set X = 1 and later set X= 2 it will be X=2 

Taifun

Min Zarni Aung

unread,
Aug 16, 2015, 12:22:14 PM8/16/15
to MIT App Inventor Forum
The same thing happened to me a few days ago. I have 3 screens in my app and the third screen contains a little game with canvas and sprites. When a user finish the game, two sprites acting like reset and back button should appear in my desire location which I move with MoveTo feature. When I testing that app, these two sprites never appear in my desire location and I can not find any error in the block. It move correctly when I try with Do It function. So I just built the apk file and install it on my phone, then the app is working correctly.
This is why I said 'some bugs in live testing'. I guess so.
Thank you Taifun, sequential execution! That explained a lot of my confusions.

Projeto AppInventor

unread,
Aug 16, 2015, 3:30:21 PM8/16/15
to MIT App Inventor Forum
You are completely right, I was testing with USB connected. By downloadig and installing the .APK in my tablet it works. Thank you so much!
Reply all
Reply to author
Forward
0 new messages