Skip to main content
Participant
July 20, 2011
Answered

Scene 1, Layer 'as', Frame 1, Line 24 1050: Cannot assign to a non-reference value.

  • July 20, 2011
  • 1 reply
  • 787 views

I'm trying to make a flash site with that automatically resizes to fit the users browser. the code i used is :

function init()
{

    stage.align=StageAlign.TOP_LEFT;
    stage.scaleMode=StageScaleMode.NO_SCALE;

    stage.addEventListener(Event.RESIZE, updateSize);
    stage.dispatchEvent(new Event(Event.RESIZE));

    myBackground.x = 0;
    myBackground.y = 0;

}

init();

function updateSize(e:Event)
{

    myBackground.width = stage.stageWidth;
    myBackground.height = stage.stageHeight;

    myContent.x = stage.stageWidth/2 = myContent.width/2;
    myContent.y = stage.stageHeight/2 = myContent.height/2;
}

******i keep getting the error "cannot assign to a non-reference value.*******

This topic has been closed for replies.
Correct answer Ned Murphy

Well you will need to determine what you want to be the basis for defining the sizes and assign each separately.

You cannot have:  "something = an equation = an equation"   like you have

(curious - does your iPhone automatically tag on that 'Sent from' blurb?)

1 reply

Ned Murphy
Legend
July 21, 2011

Whatever you are trying to do with these lines needs to be undone...

    myContent.x = stage.stageWidth/2 = myContent.width/2;
    myContent.y = stage.stageHeight/2 = myContent.height/2;

Participant
July 24, 2011

Hi,

I was trying to have the background and content resize to fit the user browser (fluid)... I think I can just use the "myBackground" code and wrap everything into that movie clip...

I didn't think it would be this frustrating...

Sent from my iPhone

Ned Murphy
Ned MurphyCorrect answer
Legend
July 24, 2011

Well you will need to determine what you want to be the basis for defining the sizes and assign each separately.

You cannot have:  "something = an equation = an equation"   like you have

(curious - does your iPhone automatically tag on that 'Sent from' blurb?)