The first thing you wrote will cause an error, because it's trying to call a function called "layer" on mySprite and pass in 1 as an argument. But the sprite doesn't have a layer function, so it can't be called.
The second thing you wrote will work; it will create a property on the sprite called "layer" and give it a value of 1. But it won't do anything further unless you make it do something.
I see.
Let me give you the full script, maybe that will provide a bit more clarity.
const dir = $gameVariables.value(2311);
const filename = $gameVariables.value(2332);
const url = dir + "/" + Utils.encodeURI(filename) + ".jpg";
const sc = SceneManager._scene;
if (!sc._mySpriteC)
sc.addChild(sc._mySpriteC = new Sprite());
sc._mySpriteC.bitmap = ImageManager.loadBitmapFromUrl(url);
sc._mySprite.move(960, 0);
All of this works fine to load my jpg and move it where I want it. But my pngs which are loaded by the games default eventing are all placed behind the jpg.
So I wanted to assign a layer to the jpg script to place it behind the game's default pngs (which are using layers 50-60 at the moment).
I'm not sure how to write this to accomplish the desired result.