I need to edit this code

I need to edit this code. I want to make it appear when the user goes to frame number 3 or 4. Meaning, I put this code in the main class. It appears at the beginning of the application and this is considered a violation of Google policy and advertising policy. So I want to make this code appear in certain files

import so.cuo.platform.admob.*;

Admob.getInstance().initAdmobSDK(new ExtraParameter());
Admob.getInstance().cacheInterstitial("ca-app-pub-3940256099942544/1033173712"); 
if (Admob.getInstance().isInterstitialReady()) {
      Admob.getInstance().showInterstitial();
    }
	
	
	Admob.getInstance().addEventListener(AdmobEvent.onInterstitialReceive, onAdEvent);
	 function onAdEvent(event:AdmobEvent):void
	{
		if (event.type == AdmobEvent.onBannerReceive)
		{
			trace(event.instanceName,event.data.width, event.data.height);
		}
		if (event.type == AdmobEvent.onInterstitialReceive)
		{
			Admob.getInstance().showInterstitial();
		}
	}

Admin edit: edit markdown syntax