[HOW-TO] [TUTORIAL] Create your own scaleform using Flash + GFxExporter

So I now have the path F:\GTAVScaleform\GuideScaleform\project

Inside that project folder is a settings and com folder, with the com folder containing the path and files shown in this tutorial.

Also in the project folder is .actionScriptProperties, .project, AuthortimeSharedAssets.fla and GuideScaleform.fla, as well as the GuideScaleform.swf when I export it.

The classpath is set to F:\GTAVScaleform\GuideScaleform\project

After setting all that, the _Packages folder still isn’t being created.

Is the project used for this tutorial available for download at all? I obviously don’t want to take up people’s time trying to solve this because this is probably a me issue. I am old now and sometimes struggle to get my brain in gear, so I am probably missing a fundamental but simple step to getting this right. Your help is genuinely appreciated.

nope… the project folder should only contain com folder and its .as content
Evrything else should be outside of project

an example is on my github GitHub - manups4e/NativeUI-scaleform_flash

I think I am just going to have to take the loss on this one, even publishing your project has the same result. Maybe there is something wrong with my Flash installation, or perhaps something isn’t converting properly with GFExport…

Thank you for your help anyway but I don’t want to take up more of your time.

no that’s fine! to publish my repo you must change the path in the actionscript settings


image

because this one is on my computer… and i’m pretty sure this :poop: of flash is going to keep it and you should change it to the same path on your computer… but leading to the same folder…

I had actually done that and it had failed but when I have just changed it to a relative classpath with .\project\ yours has built with the _Packages present in JPEXS

I have just turned off the Publish Cache though so I don’t know if that had affected anything.

However, after building my project, it still fails… so I obviously need to investigate further with that.

so far in my projects the only reason for missing the _Packages folder in JPEXS was the wrong path in “ActionScript settings” options

That would make sense but both projects now have the same relative classpath and that’s why I am so confused. I think what I am going to try, is deleting the project I have built and start again going through this tutorial step-by-step.

I mean if I can’t get this simple tutorial project working, then it’s probably a sign that I should stick to C# and script mods. But it’s equally frustrating that I can write complex C# mods and yet can’t get a simple project working for a language I used to use as part of my profession.

I created a side-by-side of both projects to show what I mean with the classpaths. Again, thank you for your help… if my rebuild doesn’t work then I will call it a day.

I rebuilt the project and got the exact same result. No matter whether I use an absolute path or a relative path, it just isn’t outputting that _Packages section.

There are only 4 possible options and that’s absolute to either project or com, or relative to project or com. If none of those are correct, I don’t know what correct can possibly be… there are no other options.

I know this might sound an unreasonable request but could you please consider at some point creating the project from this tutorial and adding it as a download so that people learning have a known working project to work from?

I fully understand if this is not something you want to do though, so please don’t worry about saying no.

sure i’ll upload it asap

solution here: Can someone help with getting this Custom Scaleform tutorial project to build properly please? - #2 by manups4e

Hello there! I followed your tutorial and everything went smooth…up until this point:

I can’t seem to make the game load images properly. For instance, I’m rebuilding the whole phone interface, and I tried to add a simple .png background in my scaleform. The scaleform gets successfully loaded into the game, but instead of the phone background, it shows a white rectangle:


(Ignore the black background, it’s just the oversized BOUNDING_BOX, needed to be that big to help me figure out how does it work)

However, back to the .png, this is the directory of my project:

As you can see, the images have been turned into a .tga file from the gfxexporter, rather than a .dds, as you said in the tutorial. Maybe is that the problem?

ok if you want a better way to load pngs inside your scaleform is by doing this

  • First of all… add an empty movie clip inside your project and call it txdLoader
    image
    like this

    the class you wanna link is com.rockstargames.ui.media.ImageLoaderMC
  • Then in your script in the MAIN.as file of your project add these 3 public functions
    function ADD_TXD_REF_RESPONSE(txd, strRef, success)
    {
        com.rockstargames.ui.utils.Debug.log("ADD_TXD_REF_RESPONSE - " + arguments.toString());
        if (success == true)
        {
            var pMC = this.CONTENT;
            var il = com.rockstargames.ui.media.ImageLoaderMC(eval(pMC + "." + strRef));
            if (pMC != undefined)
            {
                il.displayTxdResponse(txd);
            }
        }
    }

    function TXD_HAS_LOADED(txd, success, strRef)
    {
        com.rockstargames.ui.utils.Debug.log("TXD_HAS_LOADED - " + arguments.toString());
        if (success == true)
        {
            var pMC = this.CONTENT;
            var il = com.rockstargames.ui.media.ImageLoaderMC(eval(pMC + "." + strRef));
            if (pMC != undefined)
            {
                il.displayTxdResponse(txd,success);
            }
        }
    }

    function TXD_ALREADY_LOADED(txd, strRef)
    {
        com.rockstargames.ui.utils.Debug.log("TXD_ALREADY_LOADED - " + arguments.toString());
        var pMC = this.CONTENT;
        var il = com.rockstargames.ui.media.ImageLoaderMC(eval(pMC + "." + strRef));
        if (pMC != undefined)
        {
            il.displayTxdResponse(txd,true);
        }
    }
  • Then use the attachMovie() function to add the txdLoader in your code wherever you want…

  • When you want to load any txd, txn (DUI or ingame or streamed) use this function around your code to dynamically load your txd-txn via scaleform natives

function SetClip(targetMC, textureDict, textureName, w, h, callback, scope)
{
	var alreadyLoaded = true;
	if (targetMC.textureFilename != textureName && targetMC.textureDict != textureDict)
	{
		var alreadyLoaded = false;
	}
	targetMC.init("YOUR-GFX-NAME",textureDict,textureName,w,h);
	var splitPath = String(targetMC).split(".");
	var pathWithoutContent = splitPath.slice(2).join(".");
	com.rockstargames.ui.tweenStar.TweenStarLite.removeTweenOf(targetMC);
	targetMC._alpha = 100;
	targetMC.requestTxdRef(pathWithoutContent,alreadyLoaded,callback,scope);
}

I made the function SetClip to dynamically load any texture without the need to Load it before via natives… the scaleform will load it and draw it for you…

SetClip has these parameters:

  • targetMC: the txdLoader movieClip you reference
  • textureDict: the texture dictionary (runtime, dui, ingame, streamed… who cares)
  • textureName: the name of the texture to load
  • w, h: width and height of the texture you wanna draw
  • callback: any function you wanna call whenever the load is finished (optional)
  • scope: i usually use “this” to reference all the class i’m using… for example if i’m drawing a badge in ScaleformUI inside a UIMenuItem i reference this as the whole UIMenuItem isntance inside the function (that’s how flash works :smiley: )

example:
– this function is called inside UIMenuItem in NativeUI-scaleform_flash in my github

	function SetLeftBadge(id)
	{
		this.leftBadgeId = id;
		if (this.leftBadgeId != com.rockstargames.ScaleformUI.utils.Badges.NONE)
		{
			if (this.leftBadgeMC.isLoaded)
			{
				this.leftBadgeMC.removeMovieClip();
			}
			this.leftBadgeMC = this.itemMC.attachMovie("txdLoader", "LeftBadge", this.itemMC.getNextHighestDepth());
			var sprite_name = com.rockstargames.ScaleformUI.utils.Badges.getSpriteNameById(id, this.highlighted);
			var sprite_txd = com.rockstargames.ScaleformUI.utils.Badges.GetSpriteDictionary(id);
			SetClip(this.leftBadgeMC,sprite_txd,sprite_name,24,24,this.leftBadgeLoaded,this);
			this.itemMC.labelMC._x = 28.25;
		}
		else
		{
			if (this.leftBadgeMC.isLoaded)
			{
				this.leftBadgeMC.removeTxdRef();
				this.leftBadgeMC.removeMovieClip();
				this.itemMC.labelMC._x = 5;
			}
		}
		this.updateLabelWidth();
	}

	function leftBadgeLoaded()
	{
		this.leftBadgeMC._visible = true;
		this.leftBadgeMC._width = 24;
		this.leftBadgeMC._height = 24;
		this.leftBadgeMC._x = 0.5;
		this.leftBadgeMC._y = 0.5;
		this.updateLabelWidth();
	}

Also… rebuilding the ingame phone is a big project… i would start from something smaller… and grow step by step…

Oh, finalmente qualcuno che risponde, e anche celermente :smiley:
Anyway, thanks for the quick reply, I appreciate that! I’ll start working on it in the following days. I think :joy:
I know it’s a big project, but I don’t really like the many NUI phones out there (I don’t like NUIs in general, I prefer scaleforms) and the default phone is good, but very limited. So that’s why I had the idea to rebuild it (consider it the upgraded model :joy:)
But anyway, I’m used to hard work, I’m not afraid of the coding part^^ (now, about the graphic part, that’s another story…)

Ahahahah tranquillo se posso rispondo sempre!
:blush:
Anyway the code I provided you gives you should help loading dynamically any texture… you can check ScaleformUI main Readme on GitHub :blush: join my community and we can help you

1 Like

Your code is very clear…except for one part :joy:

SetClip()

From what I understood, I need to call this function to load txds from my scripts, I get that (I guess the appropriate native would be this: CallScaleformMovieMethodWithString)
My only doubt is the scope. How can I pass it as a parameter from, say, a .lua script? All the other parameters are fine, scope is the only one I can’t figure out how to pass

The only thing you pass from lua is TXD,TXN, WIDTH, HEIGHT all other params are internal to flash
Scope is flash way to say “in the callback what can I see outside the callback itself?”

Got it. So I need to create an intermediate function that receives the parameters from the script, and then calls SetClip?

Something like this:

function DataFromLua(txd,txn,width,height) {
    SetClip(targetMC, txd, txn, width, height, callback, scope)
}