• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Problem with .visible

Guest
Apr 18, 2014 Apr 18, 2014

Copy link to clipboard

Copied

Hi All,

I am creating a comment box in my training tracking tool. General idea was something like that :
1. click icon -> comment box appear

2. enter text -> click 'ok' or 'cancel' button -> close comment box and add to flash coockie.

3. change icon colour if any comment in it.

I created all instances and the issue is that, when you click the icon "Comm1a" (empty) or "Comm1b" (with comment) comment box appear just for milisecond and disappear. I copy whole code to the new file and it works. Don't know why in original file it doesn't.

Please note that:

CommentBox1 - is TextArea for comment

Comm1a - is button for comment box w/o comment

Comm1b - is button for comment box with comment

Comm1ton - is button with mouse over for adding comment

Comm1non - is button with mouse away for deleting comment

Comm1tout - is movie clip on Comm1ton to change graphic depends from mouse position

Comm1nout - is movie clip on Comm1non to change graphic depends from mouse position


import flash.events.Event;

import flash.ui.Mouse;

import flash.events.MouseEvent;

Comm1a.addEventListener(MouseEvent.CLICK,clickComm1a);

Comm1b.addEventListener(MouseEvent.CLICK,clickComm1a);

Comm1ton.addEventListener(MouseEvent.CLICK,AddComm1);

Comm1non.addEventListener(MouseEvent.CLICK,RemoveComm1);

Comm1tout.addEventListener(MouseEvent.ROLL_OVER,over1ok);

Comm1ton.addEventListener(MouseEvent.ROLL_OUT,out1ok);

Comm1nout.addEventListener(MouseEvent.ROLL_OVER,over1no);

Comm1non.addEventListener(MouseEvent.ROLL_OUT,out1no);

 

var so = SharedObject.getLocal("frm1","/"); // SO

 

Comm1b.visible = false;

CommentBox1.visible = false;

Comm1tout.visible = false;

Comm1ton.visible = false;

Comm1nout.visible = false;

Comm1non.visible = false;

 

function clickComm1a(event:MouseEvent):void{

          CommentBox1.visible = true;

          Comm1tout.visible = true;

          Comm1nout.visible = true;

}

function over1ok (event:MouseEvent):void{

          Comm1tout.visible = false;

          Comm1ton.visible = true;

}

function out1ok (event:MouseEvent):void{

          Comm1tout.visible = true;

          Comm1ton.visible = false;

}

function over1no (event:MouseEvent):void{

          Comm1nout.visible = false;

          Comm1non.visible = true;

}

function out1no (event:MouseEvent):void{

          Comm1nout.visible = true;

          Comm1non.visible = false;

}

function AddComm1(event:MouseEvent):void{

          CommentBox1.visible = false;

          Comm1tout.visible = false;

          Comm1ton.visible = false;

          Comm1nout.visible = false;

          Comm1non.visible = false;

          so.data.CommentBox1=CommentBox1.text;

          so.flush();

          Comm1a.visible = false;

          Comm1b.visible = true;

}

function RemoveComm1(event:MouseEvent):void{

          CommentBox1.visible = false;

          Comm1tout.visible = false;

          Comm1ton.visible = false;

          Comm1nout.visible = false;

          Comm1non.visible = false;

          so.data.CommentBox1=null;

          so.flush();

          CommentBox1.text == null;

          Comm1a.visible = true;

          Comm1b.visible = false;

}

Plus new issue appear. When you press "ok" or "cancel" button which triggers RemoveComm1 or AddComm1, the button you clicked stays visible.

Thanks in advance for any suggestions.

TOPICS
ActionScript

Views

273

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Apr 18, 2014 Apr 18, 2014

Copy link to clipboard

Copied

I fixed the issue with the staying "ok" or "cancel" buttons. Still I do not know what it is not working within original program, where i do not use any other libraries or objects that may couse an issue.

I putted addListeners OVER when button appear and removeListeners OUT when button disappear:

import fl.accessibility.CheckBoxAccImpl;

import fl.controls.ProgressBarDirection;

import fl.controls.ProgressBarMode;

import flash.events.Event;

import flash.ui.Mouse;

import flash.events.MouseEvent;

Comm1a.addEventListener(MouseEvent.CLICK,clickComm1a);

Comm1b.addEventListener(MouseEvent.CLICK,clickComm1a);

Comm1ton.addEventListener(MouseEvent.CLICK,AddComm1);

Comm1non.addEventListener(MouseEvent.CLICK,RemoveComm1);

var so = SharedObject.getLocal("frm1","/"); // SO

Comm1b.visible = false;

CommentBox1.visible = false;

Comm1tout.visible = false;

Comm1ton.visible = false;

Comm1nout.visible = false;

Comm1non.visible = false;

function over1ok (event:MouseEvent):void{

          Comm1ton.visible = true;

          Comm1tout.visible = false;

          Comm1ton.addEventListener(MouseEvent.ROLL_OUT,out1ok);

}

function out1ok(e:MouseEvent):void {

          Comm1ton.visible = false;

          Comm1tout.visible = true;

          Comm1ton.removeEventListener(MouseEvent.ROLL_OVER, out1ok);

}

function over1no (event:MouseEvent):void{

          Comm1non.visible = true;

          Comm1nout.visible = false;

          Comm1non.addEventListener(MouseEvent.ROLL_OUT,out1no);

}

function out1no(e:MouseEvent):void {

          Comm1non.visible = false;

          Comm1nout.visible = true;

          Comm1non.removeEventListener(MouseEvent.ROLL_OVER, out1no);

}

function clickComm1a(event:MouseEvent):void{

          CommentBox1.visible = true;

          Comm1tout.visible = true;

          Comm1nout.visible = true;

          Comm1tout.addEventListener(MouseEvent.ROLL_OVER,over1ok);

          Comm1nout.addEventListener(MouseEvent.ROLL_OVER,over1no);

}

function AddComm1(event:MouseEvent):void{

          so.data.CommentBox1=CommentBox1.text;

          so.flush();

          CommentBox1.visible = false;

          Comm1tout.visible = false;

          Comm1ton.visible = false;

          Comm1nout.visible = false;

          Comm1non.visible = false;

          Comm1a.visible = false;

          Comm1b.visible = true;

          Comm1ton.removeEventListener(MouseEvent.ROLL_OUT, out1ok);

}

function RemoveComm1(event:MouseEvent):void{

          so.data.CommentBox1=null;

          so.flush();

          CommentBox1.text == null;

          CommentBox1.visible = false;

          Comm1tout.visible = false;

          Comm1ton.visible = false;

          Comm1nout.visible = false;

          Comm1non.visible = false;

          Comm1a.visible = true;

          Comm1b.visible = false;

          Comm1non.removeEventListener(MouseEvent.ROLL_OUT, out1no);

}

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Apr 18, 2014 Apr 18, 2014

Copy link to clipboard

Copied

To put things simplier :

WHY THIS IS NOT WORKING ? :

CommentBox1.visible = false;

Comm1tout.visible = false;

Comm1ton.visible = false;

Comm1nout.visible = false;

Comm1non.visible = false;

Comm1a.addEventListener(MouseEvent.CLICK,clickComm1a);

Comm1b.addEventListener(MouseEvent.CLICK,clickComm1a);

function clickComm1a(event:MouseEvent):void{

          CommentBox1.visible = true;

          Comm1tout.visible = true;

          Comm1nout.visible = true;

}

Right after the click, objects appear and immediately disappear. If you click rapidly, you can see them switching.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Apr 18, 2014 Apr 18, 2014

Copy link to clipboard

Copied

LATEST

I resolved the issue... I copied everything, ctrl+a, all objects and AS code and putted in new file. Everything works as it should be. I spent 2 days looking for resolution, cause I was sure it should work....

Now simple question : WHY ?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines