1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Coding Help

Discussion in 'Help' started by Shade, Jan 8, 2013.

  1. Shade

    Shade Swell Supporter Content Creator

    Joined:
    Jun 19, 2011
    Messages:
    363
    Likes Received:
    25
    So I'm currently in the process of learning Action Script 3 (Via Google), and I've run into an issue I'm not sure how to overcome. I've learned how to make basic buttons, change viability, etc, and I've discovered how to path to difference Instances within the project, but only going 'forward', so child instances of a parent instance. I'm wondering if it's possible to path to an instance on the main stage, outside of the instance the code is placed in. Basically, something like.
    ________________________________________

    Main Stage

    Instance 'Top' Instance 'Bottom'

    Instance 'Chest' + Code Block Instance 'RightLeg'

    Instance 'Design' Instance 'Design'​

    ________________________________________

    I'm looking to have the code block change the visibility of the Chest Instance (Which I know how to do), and the visibility of the Bottom Instance, (Which I know the code for, but not how to path/reference to it via the main stage.); I'm also not sure if it's possible. I've read that the main stage is referred to as main and/or Stage for pathing/referencing, but doing that doesn't seem to work. I also tried to put the code I want to use on the main stage, but keep getting a compile error, which basically says event mouse click isn't a compile option.

    Any ideas? Hope my pretty (shitty) picture helps.

    Edit:
    Clarified my post a bit because apparently reading past half asleep typos is hard.
     
  2. Doomknight

    Doomknight Guest

    As I'm not a coder... (if this is just rambling ignore; but it may not be XD)
    Most of what you said makes little sense, partly because of numerous spelling mistakes that change the meaning of your sentences, but mostly because I'm not a programmer or a coder, and coding makes little sense to me in general.

    What I do get is that you know how to change the chest area of Her, but not the bottom area of Her. Where it seems that the top part of Her is dynamic, whereas the bottom is fixed/static.

    As far as the Parent to Child instance thing, with my understanding of discrete math, trying to reference something from the Parent to go to the Parent instance is a circular reference and will definitely cause compile/syntax errors.

    If you could explain what instances you were thinking of referencing to eachother from the main stage, then that would be important to know; what you are trying to reference, may not actually be part of the main stage, but also be a child instance.

    If it happens to be that the top part of Her and the bottom part of Her may not be part of the main stage, and may in fact be child instances, then you should be able to reference them without incurring errors.

    Some semi-useful sites that may assist you:
    http://forums.adobe.com/message/2705364
    http://stackoverflow.com/questions/2496081/access-main-stage-from-class-definition-file-as3
    http://stackoverflow.com/questions/4768571/how-do-i-access-the-main-classs-stage-can-i-pass-functions-as-arguments-like
    http://activeden.net/forums/thread/change-stage-width-height-just-with-actionscript/8854

    You mentioned at the end Mouse Click Event, and in the SDT.swf file I came up with these:

    [DROPDOWN MENU]
    package obj.ui
    {
    import flash.display.*;
    import flash.events.*;
    import flash.text.*;

    public class DropdownMenuItem extends MovieClip
    {
    public var label:TextField;
    private var _selected:Boolean = false;
    private var _clickCallback:Function;
    private var _labelText:String;

    public function DropdownMenuItem(param1:String, param2:Function) : void
    {
    this.label.text = param1;
    this._labelText = param1;
    this._clickCallback = param2;
    addEventListener(MouseEvent.CLICK, this.clicked);
    addEventListener(MouseEvent.MOUSE_DOWN, this.pressed);
    addEventListener(MouseEvent.MOUSE_UP, this.released);
    addEventListener(MouseEvent.ROLL_OVER, this.rolledOver);
    addEventListener(MouseEvent.ROLL_OUT, this.rolledOut);
    gotoAndStop("normal");
    return;
    }// end function

    public function select(param1:Boolean = true) : void
    {
    this._selected = param1;
    if (this._selected)
    {
    gotoAndStop("down");
    }
    else
    {
    gotoAndStop("normal");
    }
    return;
    }// end function

    private function pressed(event:MouseEvent) : void
    {
    gotoAndStop("down");
    return;
    }// end function

    private function released(event:MouseEvent) : void
    {
    if (this._selected)
    {
    gotoAndStop("down");
    }
    else
    {
    gotoAndStop("normal");
    }
    return;
    }// end function

    private function rolledOver(event:MouseEvent) : void
    {
    gotoAndStop("over");
    return;
    }// end function

    private function rolledOut(event:MouseEvent) : void
    {
    if (this._selected)
    {
    gotoAndStop("down");
    }
    else
    {
    gotoAndStop("normal");
    }
    return;
    }// end function

    private function clicked(event:MouseEvent) : void
    {
    this._clickCallback(this);
    return;
    }// end function

    public function get labelText() : String
    {
    return this._labelText;
    }// end function

    }
    }

    [DROPDOWN BUTTON]
    package obj.ui
    {
    import flash.display.*;
    import flash.text.*;

    public class DropdownButton extends Dropdown
    {
    public var dropdownButton:DropdownButtonArrow;
    public var dropdownWindow:MovieClip;
    public var dropdownLabel:TextField;

    public function DropdownButton() : void
    {
    return;
    }// end function

    }
    }

    [DROPDOWN MENU ITEM]
    package obj.ui
    {
    import flash.display.*;
    import flash.events.*;
    import flash.text.*;

    public class DropdownMenuItem extends MovieClip
    {
    public var label:TextField;
    private var _selected:Boolean = false;
    private var _clickCallback:Function;
    private var _labelText:String;

    public function DropdownMenuItem(param1:String, param2:Function) : void
    {
    this.label.text = param1;
    this._labelText = param1;
    this._clickCallback = param2;
    addEventListener(MouseEvent.CLICK, this.clicked);
    addEventListener(MouseEvent.MOUSE_DOWN, this.pressed);
    addEventListener(MouseEvent.MOUSE_UP, this.released);
    addEventListener(MouseEvent.ROLL_OVER, this.rolledOver);
    addEventListener(MouseEvent.ROLL_OUT, this.rolledOut);
    gotoAndStop("normal");
    return;
    }// end function

    public function select(param1:Boolean = true) : void
    {
    this._selected = param1;
    if (this._selected)
    {
    gotoAndStop("down");
    }
    else
    {
    gotoAndStop("normal");
    }
    return;
    }// end function

    private function pressed(event:MouseEvent) : void
    {
    gotoAndStop("down");
    return;
    }// end function

    private function released(event:MouseEvent) : void
    {
    if (this._selected)
    {
    gotoAndStop("down");
    }
    else
    {
    gotoAndStop("normal");
    }
    return;
    }// end function

    private function rolledOver(event:MouseEvent) : void
    {
    gotoAndStop("over");
    return;
    }// end function

    private function rolledOut(event:MouseEvent) : void
    {
    if (this._selected)
    {
    gotoAndStop("down");
    }
    else
    {
    gotoAndStop("normal");
    }
    return;
    }// end function

    private function clicked(event:MouseEvent) : void
    {
    this._clickCallback(this);
    return;
    }// end function

    public function get labelText() : String
    {
    return this._labelText;
    }// end function

    }
    }

    Hope some of this helps!
     
  3. Shade

    Shade Swell Supporter Content Creator

    Joined:
    Jun 19, 2011
    Messages:
    363
    Likes Received:
    25
    Grammatical errors, not spelling mistakes. ;) That's what happens when you type half asleep.

    See the pretty picture I made with text. That's pretty much how my FLA is organized, and how it's required to be organized for the compiling code. In case that still isn't clear. From code with in the 'Chest' Instance (Which is a child of the 'Top' instance) I'm looking at changing the viability of the 'RightLeg' Instance (Which is a child of the 'Bottom' Instance)

    They are on the main stage, if they weren't, the mod wouldn't work at all. That is not the issue. The issue is when I try something like:

    stage.Bottom.RightLeg.visible = false;

    I get.

    Symbol 'Chest', Layer 'Settings', Frame 1, Line 19 1119: Access of possibly undefined property Bottom through a reference with static type flash.display:Stage.

    Anyway, this is more a question for someone with Action Script knowledge...
     
  4. Doomknight

    Doomknight Guest

    It is true, that I'm not familiar with AS3, but I am familiar with logic problems, and this sounds like a logic problem, and as all coding is logic-based, I'd then assume that I may be able to indirectly help you by helping you narrow down the issue, rather than explain how to exactly code it.

    [CHARACTER CONTROL]
    -> Appears that the leg is broken up into parts. It may be having trouble making the right leg invisible because the components of the right leg are child instances of the right leg. Removing the parent instance from the child instances I'm sure would cause errors. If the Right Leg of course is the parent instance.

    _as3_getproperty ankleCuffsControl
    _as3_getlex g
    _as3_getproperty her
    _as3_getproperty torso
    _as3_getproperty rightCalfContainer
    _as3_getproperty cuffs
    _as3_getlex g
    _as3_getproperty her
    _as3_getproperty leftLegContainer
    _as3_getproperty leg
    _as3_getproperty cuffs

    _as3_getproperty pantiesControl
    _as3_getlex g
    _as3_getproperty her
    _as3_getproperty torso
    _as3_getproperty rightThighCostume
    _as3_getproperty panties
    _as3_getlex g
    _as3_getproperty her
    _as3_getproperty leftLegContainer
    _as3_getproperty leg
    _as3_getproperty leftThighCostume
    _as3_getproperty panties

    [HER]
    -> This spoiler contains a list of all the variables and objects attached to "Her". There is no "Right Leg". There is a "Left Leg" though. Try making the "Left Leg" invisible.
    public var earrings:Earrings;
    public var gagBack:MovieClip;
    public var torsoBackCostume:MovieClip;
    public var hairTop:MovieClip;
    public var torso:MovieClip;
    public var gagFront:MovieClip;
    public var eye:MovieClip;
    public var bottomLipstick:MovieClip;
    public var hairMidContainer:MovieClip;
    public var collarContainer:MovieClip;
    public var rightEyebrow:MovieClip;
    public var freckles:Freckles;
    public var tongueContainer:MovieClip;
    public var leftEyebrow:MovieClip;
    public var hairCostumeUnderLayer:MovieClip;
    public var topLipTongue:MovieClip;
    public var leftLegContainer:MovieClip;
    public var blush:MovieClip;
    public var head:MovieClip;
    public var ear:MovieClip;
    public var topLipstickContainer:MovieClip;
    public var torsoUnderCostume:MovieClip;
    public var tears:Tears;
    public var torsoBack:MovieClip;
    public var eyewear:MovieClip;
    public var hairBetweenLayer:MovieClip;
    public var initialised:Boolean = false;
    public var hairBackContainer:HairBackContainer;
    public var rightArmContainer:HerRightArmContainer;
    public var rightForeArmContainer:HerRightForeArmContainer;
    public var leftArmContainer:HerLeftArmContainer;
    public var backModContainer:Sprite;
    public var userHasClicked:uint = 0;
    public var heldTimer:uint = 0;
    public var _tan:Tan;
    public var _penisControl:HerPenisControl;
    public var currentMood:String = "Normal";
    public var deepthroatDistance:Number = 150;
    public var deepthroatStartDistance:Number = 75;
    public var hiltDistance:Number = 0;
    public var releasedPos:Number = -0.15;
    public var maxPos:Number = 1.02;
    public var minPos:Number = -0.25;
    public var pos:Number = 0;
    public var speed:Number = 0;
    public var acceleration:Number = 0;
    public var speedFriction:Number = 0.5;
    public var moveSmoothing:Number = 3;
    public var mouseHeld:Boolean = false;
    public var penisOutDelay:uint = 0;
    public var lastPenisDirection:Number = -1;
    public var penisInMouthDist:Number = 0;
    public var currentPenisTipPos:Number = 0;
    public var mouthLength:Number = 0;
    public var penisTipMouthOffset:Number = 0;
    public var intro:Boolean = true;
    public var introStartDist:Number = 80;
    public var maxIntroDist:Number;
    public var introRelaxDist:Number = 15;
    public var introPosToBeMoved:Boolean = false;
    public var firstDT:Boolean = true;
    public var movement:Number = 0;
    public var absMovement:Number = 0;
    public var previousMovement:Number = 0;
    public var lastYPos:Number;
    public var absYMovement:Number = 0;
    public var vigour:Number = 0;
    public var VIGOUR_WINCE_LEVEL:uint = 1000;
    public var downTravel:Number = 0;
    public var upTravel:Number = 0;
    public var torsoJointAng:Number = 0;
    public var torsoJointDist:Number = 0;
    public var minBodyScale:Number = 0.95;
    public var maxBodyScale:Number = 1.075;
    public var bodyScale:Number = 1;
    public var headTilt:Number = 0;
    public var headTiltScaling:Number = 1;
    public var headTiltTarget:Number = 0;
    public var headTiltAngle:Number = 0;
    public var breathingFactor:Number = 0;
    public var randomMotion:Object;
    public var previousPos:Number = 0;
    public var cheekBulgeTarget:Number = 0;
    public var cheekSuckTarget:Number = 0;
    public var suckPower:Number = 0;
    public var neckSkinOffset:Number = 2;
    public var offActionTimer:uint = 0;
    public var offActionTime:uint = 9000;
    public var noseSquashUp:LinearTween;
    public var noseSquashDown:LinearTween;
    public var currentNoseSquash:LinearTween;
    public var noseSquashAmount:Number = 0;
    public var lastNoseSquash:Boolean = false;
    public var torsoIK:IKController;
    public var leftLegStartPoint:Point;
    public var mHer:Matrix;
    public var mZero:Matrix;
    public var currentArmPosition:uint = 0;
    public var activeArmMovement:Boolean = false;
    public var armsFree:Boolean = false;
    public var armsPushing:Boolean = false;
    public var armsPushPower:Number = 0;
    public var armsPushPowerMax:Number = 40;
    public var armsPushTimer:uint;
    public var rightHandOnLegs:Point;
    public var leftHandOnLegs:Point;
    public var rightHandOnHim:Point;
    public var leftHandOnHim:Point;
    public var leftArmIK:IKController;
    public var rightArmIK:IKController;
    public var leftShoulderPos:Point;
    public var rightShoulderPos:Point;
    public var foreArmPos:Point;
    public var armIKOffset:Point;
    public var armIKOffsetSpeed:Point;
    public var gagged:Boolean = true;
    public var gaggedRotation:Number = 6;
    public var resistance:Object;
    public var previousResistance:Number;
    public var pullOff:Number = 0;
    public var pullOffPower:Object;
    public var pullingOff:Boolean = true;
    public var released:Boolean = true;
    public var coughing:Boolean = false;
    public var coughFactor:Number = 0;
    public var coughBuild:Number = 0;
    public var nextCoughTime:int;
    public var justCoughed:Boolean = false;
    public var startSwallowTimer:uint = 0;
    public var startSwallowTime:uint = 30;
    public var closedJawAngle:Number = -12;
    public var swallowTilt:Number = -0.2;
    public var aboveSwallowTilt:Boolean = false;
    public var jawAngleTarget:Number = 0;
    public var swallowing:Boolean = false;
    public var lipSkinOffset:uint = 0;
    public var jawBulgeTarget:int = 0;
    public var swallowTimer:uint = 0;
    public var swallowPoint:Number = 0;
    public var swallowSequence:Object;
    public var tongue:Tongue;
    public var topTeethTween:LinearTween;
    public var bottomTeethTween:LinearTween;
    public var clenchTeeth:Boolean = false;
    public var clenchTeethRatio:Number = 0;
    public var clenchedTeethTimer:int = 0;
    public var clenchedTeethTime:uint = 0;
    public var speaking:Boolean = false;
    public var speakStopDelay:uint = 0;
    public var targetPhoneme:Object;
    public var phonemeDelay:uint;
    public var lastUpperLipPos:uint = 0;
    public var lastLowerLipPos:uint = 0;
    public var eyeMotion:Object;
    public var eyelidMotion:Object;
    public var eyePosBlink:uint = 150;
    public var eyePosWince:uint = 200;
    public var blinkTime:uint = 1;
    public var blinkTimer:uint = 0;
    public var winceTimer:uint = 0;
    public var lookChangeTimer:int = -1;
    public var cumInEye:uint = 0;
    public var leftEyebrowNormalTween:LinearTween;
    public var rightEyebrowNormalTween:LinearTween;
    public var rightEyebrowAngryTween:LinearTween;
    public var leftEyebrowAngryTween:LinearTween;
    public var eyebrowOffsets:Vector.<uint>;
    public var passedOut:Boolean = false;
    public var passOutFactor:Number = 0;
    public var passOutMax:Number = 40;
    public var leftBreastController:BreastController;
    public var rightBreastController:BreastController;
    public var breastCostumeOn:Boolean = false;
    public var braStrapController:BraStrap;
    public var shoulderStrapController:BraStrap;
    public var topStrapController:BraStrap;
    public var cumInMouth:uint = 0;
    public var maxCumInMouth:uint = 40;
    public var droolingCum:Boolean = false;
    public var startedCumDrool:Boolean = false;
    public var currentCumDrool:Strand;
    public var cumDroolTimer:uint;
    public var cumDrool:uint;
    public var cumDroolNum:uint;
    public var cumDroolLinkFreq:uint = 4;
    public var droolingSpit:Boolean = false;
    public var startedSpitDrool:Boolean = false;
    public var currentSpitDrool:Strand;
    public var spitDroolTimer:uint;
    public var spitDroolLinkFreq:uint = 8;
    public var gagDroolTimer:uint = 0;
    public var wetGenerate:Number = 0;
    public var fullCumInMouth:uint = 25;
    public var minNostrilSpray:uint = 5;
    public var nostrilSpraying:Boolean = false;
    public var nostrilSprayToggle:Boolean = false;
    public var currentNostrilSpray:Strand;
    public var mouthFull:Boolean = false;
    public var held:Boolean = false;
    public var hilt:Boolean = false;
    public var justHilt:Boolean = false;
    public var downPlayed:Boolean = false;
    public var upPlayed:Boolean = false;
    public var breatheDelay:uint;
    public var breatheDelayTime:uint = 10;
    public var breathing:Boolean = true;
    public var topLipA:Point;
    public var topLipB:Point;
    public var midMouth:Point;
    public var bottomLipA:Point;
    public var bottomLipB:Point;
    public var offBottomLip:Point;
    public var eyelidEnd:Point;
    public var eyelidStart:Point;
    public var nostril:Point;
    public var armConnection:Point;
    public var hairLimits:Array;
    public var eyeAim:Point;
    public var hisFace:Point;
    public var eyesDown:Point;
    public var eyesUnfocused:Point;
    public var currentLookTarget:Point;
    public var nextLookTarget:Point;
    public var blankEyed:Boolean = false;
    public var debug:Sprite;

    Its also possible that the "right leg" isn't a defined property by the game. In the spoiler it appears that the leg is broken up into parts. Maybe you have to make each invididual part of the leg become invisible instead.
     
  5. Shade

    Shade Swell Supporter Content Creator

    Joined:
    Jun 19, 2011
    Messages:
    363
    Likes Received:
    25
    It's not a game issue, it's a compiling/my-AS3-code-sucks issue. Changing the property of an instance from visible = true to visible = false does not remove that instance, it simply hides it. It would be no different if I was to change its alpha from 100% to 0% (which also doesn't work). Expanding on that, even if I don't reference the main body part, and reference a child of that (which isn't an important instance), it still doesn't work, but I can still hide that instance from with in it's parent instance; though that requires two buttons and defeats the purpose.

    Whilst code may be logic based, if you don't understand how to code, it's like trying to solve a logic based problem in Russian, and you only speak English.
     
  6. Doomknight

    Doomknight Guest

    Well, I used the SWF decompiler, and looked in all the various spots, ie G, Her, SceneLayer, etc... and I found no reference to a "Right Leg". There is plenty of references to Her "Left Leg" though. That may be the issue. Try the "Left Leg" instead of the "Right Leg".

    Logically, as it looks like her Right Leg on the screen you would assume Right Leg. But, it doesn't appear anywhere in the Action Script 3 stuff that it is defined as a property. The Left Leg is defined as a property though.

    EDIT: Maybe I should rephrase what I said. I'm ok at modifying "existing" code, but I'm no good at "creating" new code. I understand the basic structure of how a program works, but not how to create new programs, or new code lines. Just understanding existing code lines. Allows me to make "basic" mods, for many games... just not this one, as I have no idea where to start; I usually require a template/a foundation to create a Mod.
     
  7. Shade

    Shade Swell Supporter Content Creator

    Joined:
    Jun 19, 2011
    Messages:
    363
    Likes Received:
    25
    I don't think you understand, RightLeg is just an example instance name. Instance names can be anything, If you wanted to be technical, using the STDMod FLA, it would be rightThigh, regardless, it still doesn't work.

    This has nothing to do with STD, nothing to do with Decompiling it, and nothing that you'll be able to find in any of the AS files you'd gain from decompiling STD will be able to help. Adobe Flash Professional CS6, the program this is all done in, is telling me my code is incorrect. So I'm asking anyone with AS3 knowlede what the correct code is to reference to the main stage, and any instance(s) that's located on that (which isn't the instance the code is in). It may not even be possible.

    I've even tried to make a new FLA from scratch, not using any of the STD parts with a button and 4 boxes, I can hide the boxes from code with in their own instances, but I can't across instances, via the main stage.
     
  8. Faceless

    Faceless Club Regular Content Creator

    Joined:
    Jun 12, 2011
    Messages:
    1,118
    Likes Received:
    22
    Using a path like that is generally considered a bad idea. It's better practice to consider code as self-contained modules, and reference them directly. So my recommendation would be to set global variables to reference the instances, and call the variables from wherever. Dunno if that's any help to you, though.
     
  9. Shade

    Shade Swell Supporter Content Creator

    Joined:
    Jun 19, 2011
    Messages:
    363
    Likes Received:
    25
    Yeah I figured it was a horrible way of doing it, but so far that's all I'm up to, and for now it's working.

    Referencing instances via global variables probably would work, but don't I still need to set the path of where they are? Is there a way AS3 can automatically detect instances? I know in .NET I could code a function to pull every object off the main form, detect its type (button, text box, listbox, etc) then do something with it, such as reset/clear it. AS3 though, I've got no idea if anything like that is possible.

    Even using global variables, would that mean I can manipulate objects on a totally different instance on the main stage?

    I'll upload an FLA in a moment to give an example of what I'm trying to do.
     
  10. sby

    sby Club Regular Content Creator

    Joined:
    Sep 11, 2012
    Messages:
    1,337
    Likes Received:
    76
    not sure if what i am thinking is correct but, i imagine accessing stuff elsewhere like. . .

    under main stuff
    var myBottom = new Bottom();

    under Bottom stuff
    var myRightLeg = new Rightleg();

    then do something like
    main.myBottom.myRightLeg.visible = false;

    it is how i usually link instances of stuff with java :D
     
  11. Shade

    Shade Swell Supporter Content Creator

    Joined:
    Jun 19, 2011
    Messages:
    363
    Likes Received:
    25
    Okay, I'll give that a shot Sby.

    Also, here's the test FLA I put together to try this, since at one point I was sure the SDT template was just screwing with me. You will need CS5 or greater to open it.
     

    Attached Files:

  12. Doomknight

    Doomknight Guest

    Based on what I see (how the instructions are labelled), and what you are trying to do is that when you hit the red box the:

    Purple AND Blue
    OR
    Purple AND Green
    OR
    Purple AND Yellow

    Will disappear. This will leave the two remaining colors, including the red color to remain visible. EDIT: Debugger crashed. Reloaded FLA, and does have AS3. XD

    EDIT: Commenting out the whole blue thing, makes it run properly, where the purple box will disappear. However, the blue box causes a bug because it isn't related to Symbol 1. The purple box is part of Symbol 1, and that is why it will disappear. The blue box is a different symbol altogether and thats why it is undefined.

    EDIT2: Unless I'm doing something terribly wrong, but is this the only code that you used for the entire FLA?

    var isBoxShowing:Boolean = true;

    redbtn.addEventListener(MouseEvent.CLICK, toggleBox);

    function toggleBox(evt:MouseEvent):void {
    if (isBoxShowing == true) {

    /**
    * Hair
    */

    purple.visible = false
    blue.visible = false

    } else {

    purple.visible = true
    blue.visible = true

    }
    isBoxShowing = !isBoxShowing;
    };
     
  13. Shade

    Shade Swell Supporter Content Creator

    Joined:
    Jun 19, 2011
    Messages:
    363
    Likes Received:
    25
    Correct, I set it up so that was possible.

    Also correct, and it's all that's really needed for such a basic flash.

    Sby, whilst I couldn't get your way to work (though I'm trying again, as I'd like to learn it and I think it would solve the new issue I now face), you did lead me to find the correct way to reference anything off the main stage.

    Code:
    var isBoxShowing:Boolean = true;
    
    redbtn.addEventListener(MouseEvent.CLICK, toggleBox);
    
    function toggleBox(evt:MouseEvent):void
    {
    	if (isBoxShowing == true)
    	{
    
    		this.purple.visible = false;
    		Object(root).blue.visible = false;
    
    	}
    	else
    	{
    
    		this.purple.visible = true;
    		Object(root).blue.visible = true;
    
    	}
    	isBoxShowing = ! isBoxShowing;
    }

    Object(root) for absolute paths, and Object(this) for relative paths. The code in the spoiler should work in my FLA. Now, it doesn't work in SDT. However, as I know what I'm doing is now correct (Since Flash isn't yelling at me), I can use the decompiled 1.19.1b to find where SDT loads the object I'm trying to change, as it's technically in a separate mod. Hopefully Sby's way will also work, since it seems to provide the correct path automatically.



    Sby:

    Using your method, in a settings layer on the main scene I have:

    "var mytop_right = new top_right();" top_right being the parent instance name for the blue box.

    In top_right instance I have a settings layer with:

    "var myBlue_Box = new blue_box();" blue_box being the instance name for the blue box itself.

    When I go to publish/export to SWF, I get the following error:

    "main, Layer 'Settings', Frame 1, Line 1 1180: Call to a possibly undefined method top_right."

    Any idea why?

    FLA attached.
     

    Attached Files:

  14. Doomknight

    Doomknight Guest

    1) When I use the decompiler, I don't decompile the swf file. I've found that when you do that some of the links are destroyed for some reasons. Is this object you are trying to change in the compiled version AND the decompiled version? My decompiler allows me to see all the directories and variables of SDT.swf w/o decompiling it.

    2) Your code definitely works on my end as well, and compiles without a complaint and does remove both blue and purple boxes. May I ask what exactly you are trying to change?

    3) The loader hasn't been updated yet to that version; though unsure how that might affect the compiling of the file. Have you tried doing the same "mod" for an earlier version that is supported by the loader?

    4) For that error, couple of posts I found that may help:
    http://stackoverflow.com/questions/9650268/as3-call-to-a-possibly-undefined-method-through-a-refernce-with-a-static-type
    http://stackoverflow.com/questions/8718729/as3-error-1180-call-to-a-possibly-undefined-method-kill
    http://stackoverflow.com/questions/5873052/cause-of-possibly-undefined-method
    http://stackoverflow.com/questions/7055666/call-to-possibly-undefined-method-addeventlistener
    http://curtismorley.com/2008/08/25/flash-error-1180-call-to-a-possibly-undefined-method-mycustomclass/
    http://www.actionscript.org/forums/showthread.php3?t=259729
     
  15. Shade

    Shade Swell Supporter Content Creator

    Joined:
    Jun 19, 2011
    Messages:
    363
    Likes Received:
    25
    Which decompiler do you use Doomknight?

    For my Cortana Mod, I've got the option to disable the sparkles on her body/hair to increase performance on computers that dislike the abundance of glowing dots. I've got her body working perfectly fine, with the sparkles on every body part hiding themselves with the click of a single secret button.

    Her non-dynamic yet SWF hair however, is a different issue. As far as I understand, in order to have a Top and Back layer (See Hair Template if you don't understand what I mean), you need to make the hair in two separate parts and change how they export. Which, that's all fine. It exports happily and loads perfectly, and I can hide the sparkles on both parts without any issue, but it requires clicking two buttons. One on the Top part of the hair, one on the back part, both of which are required (As far as I know), to be two separate instances on the main stage.

    Now I know how to reference objects via the main stage, I can link them together, the issue is though, when that loads into SDT, the path must change, so what works for my boxes, doesn't work for the hair (linking via a relative path doesn't work either). I figure with what I know from .NET, doing it Sby's way could basically mean when I click the button, the linking via variable will basically shout 'Hey! I'm over here!', which means the path should work.

    Back to .NET ideas, if that doesn't work, I'd need to find/create a function that searches for the Back part of the Hair, and the path from the button to it.

    And yes, Top and Bottom were just examples. I figured if people had issues understanding that, there was no hope in hell they'd understand Top and Back for a hair SWF.

    Problems like these remind me why I rather working on engines and cars... Does the engine start? No. Check Electrical System. Check Fuel System. Etc...
     
  16. Doomknight

    Doomknight Guest

    SoThink SWF Decompiler 7. When it decompiles stuff it usually messes up all the directory links. But theres an option where you can look at all the components of a SWF while the SWF is active.
     
  17. Shade

    Shade Swell Supporter Content Creator

    Joined:
    Jun 19, 2011
    Messages:
    363
    Likes Received:
    25
    Alright, I use Sothing SWF Decompiler 7.2, so I'm going to guess it's the exact same thing. I've noticed that it tends to break AS when you decompile it, but it's still useful to find them in isolation and to get ideas. At least from a Modders perspective.
     
  18. Doomknight

    Doomknight Guest

    Checking engines though, isn't always as neat and easy to do either. The problem comes when the engine does start, but then for some reason stalls, and then doesn't turn back on until a period of time has elapsed and then runs fine as if the hiccup hadn't occurred.. except it occurs again and again.

    Had the problem happen to my car. Whenever I hit puddles or it was raining a lot my car would suddenly stall, and not turn on again for a period of time. And then it would start up again and be completely fine. Took it to the mechanics 5 times, and they couldn't figure out the problem. Mentioned it to a friend, and we found out by trial and error that my spark plug had a crack in it, and whenever water got in the crack, my engine would stall. After we had the spark plug replaced, the problem went away... but it was a very minute crack. Such is life right?

    But I digress,

    1) Where is the Hair Template, (tried searching and came up with the Inkskape one)?

    2) Well, if it isn't working with the two button setup, what happens when you use a single button setup, ie top layer? Does it compile, or does it give you an error?

    EDIT: Sleepy, ima hit the sack, check in tomorrow; Night, Shade.
     
  19. ModGuy

    ModGuy Club Regular Content Creator

    Joined:
    Feb 17, 2011
    Messages:
    1,754
    Likes Received:
    22
    What a mess.
    Create an array in the main code block and push target objects on to it.
    Don't reference stuff on stage.

    Once stuff is on the array create a function to loop it toggling the visibility of elements referenced within it.

    If you need assistance with this shoot me a PM.
     
  20. Shade

    Shade Swell Supporter Content Creator

    Joined:
    Jun 19, 2011
    Messages:
    363
    Likes Received:
    25
    Still the same process though. Check Electrical System. Battery Connection. Distributor. Ignition Leads. Spark Plugs. Issue found. ;) The mechanics you visited must be horrible at their job. Regardless of the issue, the first thing you do is replace the spark plugs and oil, and claim the problem is fixed. :P Change the owner a fistful of cash for 'labour costs', and sell it as a 'general service', then wait until they come back next week. :D Oh I'm horrible... Anyway.


    I'm not sure where the PNG one is, it'll be around these forums somewhere. It probably is the Inkskape one. The SWF Hair Template is the same Template used for all mods, and can be found courtesy of Synon here.

    Lack of sleep and food may have caught me out. The two button set up does work, but it's cumbersome and I'd rather link it to one button on the main part (Hair_Top) of the hair. Since the Hair_Back should always be displayed with Hair_Top.

    I'll see what I can find via Google, and let you know if I don't have much luck. My usual question though will this work for Vanilla?