trepdas Active Member Licensed User Longtime User Dec 22, 2017 #1 unfortunately , I still have problems implementing the difference with private and public variables in b4a. in vb6 I used to create an external module and declare there the public variables (to be accessed from anywhere) in vb4a I have two variables. let's say : Code: MP As MediaPlayer Public MuteFlag As Boolean I try to put those in the starter module inside the Sub Process_Globals but when I try to access it from another activity - it won't work. the only way I could compile it is by declaring it in the main module in the Sub Process_Globals and then use : Code: Main.MP.Load (File.DirAssets, "sound.wav") If Main.MuteFlag = False Then Main.MP.Play End If So where would I declare MuteFlag and call it from any module by it's name (without the Main.Muteflag) lots of text for a newbie question, I know. any kind of example codes or help or a link to a tutorial will be very appreciated Thanks
unfortunately , I still have problems implementing the difference with private and public variables in b4a. in vb6 I used to create an external module and declare there the public variables (to be accessed from anywhere) in vb4a I have two variables. let's say : Code: MP As MediaPlayer Public MuteFlag As Boolean I try to put those in the starter module inside the Sub Process_Globals but when I try to access it from another activity - it won't work. the only way I could compile it is by declaring it in the main module in the Sub Process_Globals and then use : Code: Main.MP.Load (File.DirAssets, "sound.wav") If Main.MuteFlag = False Then Main.MP.Play End If So where would I declare MuteFlag and call it from any module by it's name (without the Main.Muteflag) lots of text for a newbie question, I know. any kind of example codes or help or a link to a tutorial will be very appreciated Thanks
DonManfred Expert Licensed User Longtime User Dec 22, 2017 #2 There is NO SUCH THING like VB4A The language is b4x and your question is about B4A Upvote 0
trepdas Active Member Licensed User Longtime User Dec 22, 2017 #3 LOL Thanks. That's a good point to start with Upvote 0
DonManfred Expert Licensed User Longtime User Dec 22, 2017 #4 trepdas said: it won't work Click to expand... you should have the code inside the service, not inside the main. In all activities other than main. trepdas said: Main.MP.Play Click to expand... Main is paused at the time another activity is in front. So you can not run code in this activity. Upvote 0
trepdas said: it won't work Click to expand... you should have the code inside the service, not inside the main. In all activities other than main. trepdas said: Main.MP.Play Click to expand... Main is paused at the time another activity is in front. So you can not run code in this activity.
LucaMs Expert Licensed User Longtime User Dec 22, 2017 #5 trepdas said: I try to put those in the starter module inside the Sub Process_Globals Click to expand... In the starter module? I fear you are referring to the Main activity. Declare them in the Starter service module (and initialize them in the Service_Create). Then use them from anywhere, using Starter.MuteFlag... Upvote 0
trepdas said: I try to put those in the starter module inside the Sub Process_Globals Click to expand... In the starter module? I fear you are referring to the Main activity. Declare them in the Starter service module (and initialize them in the Service_Create). Then use them from anywhere, using Starter.MuteFlag...