Sponsor splash screen problem [Solved]


(billy2000) #21

Ok so i hacked it and made it like this: After i press start button the swf should have visible variale = false; and i writed like this(ill put some additional code):

[Embed(source = "../assetsLOGO.swf")]private const movie:Class;
	[Embed(source="../assets/NEWintro.swf")]private const moviePublisher:Class;
	private var swf:MovieClip;
	private var swfPublisher:MovieClip;

	private var timerSwfs:int = 60;
	private var playerOnce:int = 0;
	
	
	public function SwfPlayer() 
	{
		FP.stage.scaleMode = StageScaleMode.SHOW_ALL;
                FP.stage.align = StageAlign.TOP;
		
	}
	override public function update():void
	{
		
		if (timerSwfs > 0)
		timerSwfs--;
		
		if (playerOnce == 0 && timerSwfs == 0) {
			
			
			swfPublisher = new moviePublisher();
			FP.stage.addChild(swfPublisher);
			
		    swfPublisher.stage.frameRate = 24;
		    //swfPublisher.scaleX = 4;
		    //swfPublisher.scaleY = 4;
		    swfPublisher.x -= 115;
		    swfPublisher.y -= 80;
			playerOnce = 1;
		}
		
		
		if (playerOnce == 2) {
			
			swf = new movie();
			FP.stage.addChild(swf);
			
		    swf.stage.frameRate = 30;
		    swf.scaleX = 4;
		    swf.scaleY = 4;
		    swf.x = -250;
		    swf.y = -360;
			playerOnce = 3;
			 
		}
		
		
		if (playerOnce==1) {
			swfsPublisher();
		}

		if (playerOnce==3) {
			swfs();
		}

		super.update();

	}
	
           private function swfsPublisher():void
	{
		
		if (swfPublisher.visible==false)
		{
			
			FP.stage.removeChild(swfPublisher);
			
			var muteTransform:SoundTransform = new SoundTransform();
            muteTransform.volume = 0;
            swfPublisher.soundTransform = muteTransform;
			//next swf
			time = 126;
			playerOnce = 2;
		}
	}
	private function swfs():void
	{
		//Mouse.hide();
		if (time > -500)
		{
			time--;
		}
		
		if (time == 0)
		{
			swf.stage.frameRate = 60;
			FP.stage.removeChild(swf);
			
			var muteTransform:SoundTransform = new SoundTransform();
            muteTransform.volume = 0;
            swf.soundTransform = muteTransform;
			
			//world change
			playerOnce = 3;
			G.splash1 = false;
			G.stateTrans = "outC2";
		}
	}
	
	private function swfsPublisher():void
	{
		//Mouse.hide();
		//if (time > -500)
		//{
		//	time--;
		//}
		
		if (swfPublisher.visible==false)
		{
			
			FP.stage.removeChild(swfPublisher);
			
			var muteTransform:SoundTransform = new SoundTransform();
            muteTransform.volume = 0;
            swfPublisher.soundTransform = muteTransform;
			//next swf
			time = 126;
			playerOnce = 2;
		}
	}

The swf ,I see it invisible but still the swfPublisher.visible == false dosent work. Do i do something wrong?


(billy2000) #22

I gived additional info about the code in case i do something wrong >.<. Ty ultima for your help. If you still want to see a fla i can give you the swf decompiled


(Ultima2876) #23

Try the event method with your decompiled swf. Instead of setting visible = false in the fla, use dispatchEvent(new Event(“PlayClicked”, true)) (it should ‘bubble’) and then add an event listener to swfPublisher to listen for that event.


(billy2000) #24

Im going to do that right now


(billy2000) #25

Still same thing. Now i begin to think more and more if there is something wrong with my code. But still: here is the fla : intro.zip (1.9 MB)

u should find the place to change it in mcintro_12 > frame3() I gived the unmodified fla


(Ultima2876) #26

OK, so if you edit mcintro_12.as to have the following PlayIntro function:

public function PlayIntro(event: MouseEvent) : void
{
  this.btn_PlayIntro.removeEventListener(MouseEvent.MOUSE_UP, this.PlayIntro);
  MovieClip(root).dispatchEvent(new Event("buttonClick", true));
  MovieClip(root).gotoAndPlay("game");
  return;
} //end function

Then use the following stuff to load the SWF and display it:

-Class vars and embed-

[Embed(source = "../assets/intro2.swf", mimeType = "application/octet-stream")] public static var intro_pre: Class;

private var preloader_ld: Loader;
private var preloader_ld_loaded: MovieClip;

-Constructor-

preloader_ld = new Loader();
preloader_ld.loadBytes(new intro_pre as ByteArray);
preloader_ld.contentLoaderInfo.addEventListener(Event.COMPLETE, loadHandler);

-loadHandler function-

private function loadHandler(e: Event = null): void
{
//set properties of the swf here (position, scale etc)
var childSwf:DisplayObject = e.target.content;
preloader_ld_loaded = (childSwf as MovieClip);
preloader_ld_loaded.y = -150;
preloader_ld_loaded.x = -100;

//add the event listener now!
preloader_ld_loaded.addEventListener("buttonClick", startup);
}

Then the ‘startup’ function will be called on the button press. I’m not sure if loading the SWF as a ByteArray with a Loader is necessary at all - I actually think it’s just the ‘MovieClip(root).dispatchEvent’ in the fla code that fixes it - but that’s how I load SWFs so that’s how I tested it on my end!

Sorry for the late response btw, I was asleep!


(billy2000) #27

It works like a charm! Tank you very much. Next time ill encounter this kind of problem ill know how to do it XD


(Ultima2876) #28

Awesome, glad to hear you got it working :slight_smile:

This topic is now closed. New replies are no longer allowed.