Forums Gallery LOGIN |REGISTER

Community Archive is read-only - Here you can view content recorded up until February 2017. To join the latest discussions visit our new forums


[SOLVED] - make a progress bar with flash

If you're looking for help with Scaleform, HUD development, UI Emulator/Actions, this is the place!


 

User avatar Li Chao
Just getting started
Just getting started
 
Posts: 16
Member since: 10.07.2012, 19:34
Likes: 0

[SOLVED] - make a progress bar with flash

Postby Li Chao » 23.10.2012, 17:40

:rolleyes: hi,guys
I want to make a progress bar with flash on loading level . I found the original UI use "onloadingprogress" node to make it .

So i create a new swf ,but progress bar without any change when loading levels .
Can anybody help me? :rolleyes:
Thanks! sorry for my bad english.

here is the AS in flash:
var percent:Number=0;
loadingvol._xscale = percent*10;
Pvol.text = percent + "%";


UIElements xml
<!-- loading -->
<UIElement name="loading">
<GFx file="FlashAssets/loading.swf" layer="7">
<Constraints>
<Align mode="dynamic" halign="center" valign="center" scale="1" max="1" />
</Constraints>
</GFx>

<events>
</events>

<variables>
<!-- loading progress-->
<variable name="Percent" varname="_root.percent"/>
</variables>

</UIElement>


and fg node (attach pic)
Attachments
loading.jpg
Last edited by Li Chao on 26.10.2012, 13:18, edited 1 time in total.
User avatar Floady
Just getting started
Just getting started
 
Posts: 25
Member since: 12.01.2012, 22:15
Likes: 2

Re: Problem - make a progress bar with flash

Postby Floady » 24.10.2012, 13:13

Maybe the variable is not found? Try using a function instead of a variable.
It is easier to debug them, you can use traces for example to see what happens.
User avatar Lex4art
Senior Developer
Senior Developer
 
Posts: 817
Member since: 15.04.2008, 13:25
Location: Russia :(, Moscow
Likes: 49

Re: Problem - make a progress bar with flash

Postby Lex4art » 24.10.2012, 13:17

They not works (maybe it will be fixed with next patch): variables, arrays.
User avatar Lavizh
Lead Moderator
Lead Moderator
 
Posts: 15317
Member since: 04.12.2007, 03:23
Location: Hamar, Norway
Likes: 1141

Re: Problem - make a progress bar with flash

Postby Lavizh » 24.10.2012, 13:21

Okey i'm working on the ProgessBar now. What is loadingvol defined as in your ActionScript?
 
 
Image  Image
User avatar Li Chao
Just getting started
Just getting started
 
Posts: 16
Member since: 10.07.2012, 19:34
Likes: 0

Re: Problem - make a progress bar with flash

Postby Li Chao » 25.10.2012, 15:03

Lavizh wrote:Okey i'm working on the ProgessBar now. What is loadingvol defined as in your ActionScript?

loading.jpg
User avatar Lavizh
Lead Moderator
Lead Moderator
 
Posts: 15317
Member since: 04.12.2007, 03:23
Location: Hamar, Norway
Likes: 1141

Re: Problem - make a progress bar with flash

Postby Lavizh » 25.10.2012, 16:26

Ah a Button/Graphic which is being stretched by AS code? I'll have a look tonight.
 
 
Image  Image
User avatar Li Chao
Just getting started
Just getting started
 
Posts: 16
Member since: 10.07.2012, 19:34
Likes: 0

Re: Problem - make a progress bar with flash

Postby Li Chao » 25.10.2012, 17:23

Lavizh wrote:Ah a Button/Graphic which is being stretched by AS code? I'll have a look tonight.

yes, loadingvol is a movie clip which can stretch by ActionScript.
User avatar whx19881209
Just getting started
Just getting started
 
Posts: 11
Member since: 17.05.2012, 07:01
Likes: 0

Re: Problem - make a progress bar with flash

Postby whx19881209 » 26.10.2012, 10:03

you need a function to do this in as
User avatar Lavizh
Lead Moderator
Lead Moderator
 
Posts: 15317
Member since: 04.12.2007, 03:23
Location: Hamar, Norway
Likes: 1141

Re: Problem - make a progress bar with flash

Postby Lavizh » 26.10.2012, 10:09

the <events> tag is for calling flowgraph FROM actionscript
whereas the <functions> tag is for calling actionscript from flowgraph
 
 
Image  Image
User avatar tevans
Senior Developer
Senior Developer
 
Posts: 890
Member since: 06.09.2012, 20:32
Location: @lordsnave
Likes: 151

Re: Problem - make a progress bar with flash

Postby tevans » 26.10.2012, 11:32

You can set a variable and it will work. I do it in my inventory management system. The one difference I see is that my variable in Flash is defined as a String whereas yours is a Number. I don't know if it will be typecast correctly. Try changing percent to a String and see if the value gets set.

As for setting loadingVol, create a function in your .xml file and pass in the value you want to use as a parameter to the function. Then in that Flash function use the parameter to update loadingVol.
User avatar Li Chao
Just getting started
Just getting started
 
Posts: 16
Member since: 10.07.2012, 19:34
Likes: 0

Re: Problem - make a progress bar with flash

Postby Li Chao » 26.10.2012, 13:17

Thank you all, it is working now. I did it with function. :cheesy: :cheesy:
User avatar batigol
Regular Dev
Regular Dev
 
Posts: 539
Member since: 18.09.2012, 09:56
Location: Vietnam
Likes: 41

Re: Problem - make a progress bar with flash

Postby batigol » 28.02.2013, 06:39

tevans wrote:You can set a variable and it will work. I do it in my inventory management system. The one difference I see is that my variable in Flash is defined as a String whereas yours is a Number. I don't know if it will be typecast correctly. Try changing percent to a String and see if the value gets set.


I tried with many kind of variable but cannot get value in FG
Here is my setting
Flash:
Code: Select all
var currentCam:Number = 1;
var testValue1:String = "1";
var testValue2 = 1;


xml
Code: Select all
      <variables>
         <variable name="currentCamera" varname="currentCam"/>      
         <variable name="testValue1" varname="testValue1"/>      
         <variable name="testValue2" varname="testValue2"/>      
      </variables>


In FG, the value always 0

Could you give any advice?
Attachments
getvariableinFlash.jpg
User avatar Lavizh
Lead Moderator
Lead Moderator
 
Posts: 15317
Member since: 04.12.2007, 03:23
Location: Hamar, Norway
Likes: 1141

Re: [SOLVED] - make a progress bar with flash

Postby Lavizh » 28.02.2013, 10:54

This solution semi works allthough sometimes the loadingbar goes above 100%, done very quickly and not very optimized.

The actual data loading seems a bit wierd to me, it load chunks of data but displays it at random numbers each time, even when loading the same level over and over. Suddenly goes from 10% to 90% or 5% - 120%. Hopefully someone can have a look at this.

AS wrote:function ProgressBar(setProgressBarVal:Number)
{
var setProgressBarValOLD = Number;
setProgressBarValOLD = setProgressBarValOLD + setProgressBarVal;
trace("Updating LoadingBar")
LoadingVol_Bar_MC._xscale = setProgressBarValOLD *1;
Pvol.text = setProgressBarValOLD + "%";
fscommand("onProgressBarUpdate");
}


XML wrote:<UIElements name="Menus">

<UIElement name="LoadingScreen" mouseevents="1" keyevents="1" cursor="1" controller_input="1">

<GFx file="Atlantis_Loading_Spinner.swf" layer="3">
<Constraints>
<Align mode="fixed" valign="top" halign="left" scale="0" max="0" />
</Constraints>
</GFx>

<variables>
<variable name="Percent" fscommand="bla" varname="Percent"/>
<variable name="LevelName" varname="LevelName"/>
</variables>

</UIElement>

</UIElements>


Image
 
 
Image  Image
User avatar cylord
Just getting started
Just getting started
 
Posts: 75
Member since: 27.07.2013, 13:20
Likes: 3

Re: [SOLVED] - make a progress bar with flash

Postby cylord » 08.09.2016, 19:29

Hi, sorry for the bump,

I would like to know how do you create the "SetProgressBarVal" in your Flow Graph (the second FG)

I think that it's in the XML (for me : MainMenu.xml)
So, I try to modify it like that :

Code: Select all
<UIElements name="Menus">

   <UIElement name="MainMenu" mouseevents="1" keyevents="1" cursor="1" controller_input="1">

      <GFx file="Menus_Startmenu.swf" layer="3">
         <Constraints>
            <Align mode="dynamic" valign="center" halign="center" scale="1" max="0"/>
         </Constraints>
      </GFx>
      
      <variables>
         <variable name="Percent" fscommand="bla" varname="Percent"/>
         <variable name="LevelName" varname="LevelName"/>
      </variables>

      <functions>
         <function name="SetProgressBarVal" funcname="setProgressBarVal" desc="">
            <param name="value" desc=""/>
         </function>
      </functions>

   </UIElement>
</UIElements>


So I can see the FG "setProgressBarVal" in my FlowGraph, but still does'nt work, I missing something ?
To add the setProgressBarVal function in my MainMenu.fla maybe ?
(or in the "cryFlashLoader.as" ?)